LED
Title:LED
Author:thehappyhippy
Published:Mon, 10 Mar 2008 20:20:46 GMT

Active High LED


The LED will be illuminated when the Pout pin is made an output and is taken high.
           _____
Pout >----|_____|----|>|----.
             R       LED   _|_ 0V

Example Spin program for a LED on pin 0 ...
DIRA[0] := 1    ' Make pin 0 an Output
OUTA[0] := 1    ' Make Pin 0 high, LED on
OUTA[0] := 0    ' Make Pin 0 low,  LED off


Active Low LED


The LED will be illuminated when the Pout pin is made an output and is taken low.
                           -.- 3V3
           _____            |
Pout >----|_____|----|<|----'
             R       LED

Example Spin program for a LED on pin 0 ...
DIRA[0] := 1    ' Make pin 0 an Output
OUTA[0] := 0    ' Make Pin 0 low,  LED on
OUTA[0] := 1    ' Make Pin 0 high, LED off

Tri-Colour LED


The Red LED will be illuminated when the PoutR pin is made an output and is taken high.

The Green LED will be illuminated when the PoutG pin is made an output and is taken high.

Both LED's will be illuminated ( a yellowish colour ) when both the PoutR and PoutG lines are made outputs and taken high.
           _____     Red
PoutR >---|_____|----|>|----.
           _____            |----.
PoutG >---|_____|----|>|----'    |
             R      Green       _|_ 0V

Example Spin program for a LED on pin 0 (Red) and pin 1 (Green) ...
DIRA[0] := 1    ' Make pin 0 an Output
DIRA[1] := 1    ' Make pin 1 an Output
 
OUTA[0] := 1    ' Make Pin 0 high, and ...
OUTA[1] := 0    ' Make Pin 1 low,  Red LED on
 
OUTA[0] := 0    ' Make Pin 0 low,  and ...
OUTA[1] := 1    ' Make Pin 1 high, Green LED on
 
OUTA[0] := 1    ' Make Pin 0 high, and ...
OUTA[1] := 1    ' Make Pin 1 high, both LEDs on
 
OUTA[0] := 0    ' Make Pin 0 low,  and ...
OUTA[1] := 0    ' Make Pin 1 low,  both LEDs off

Bi-Colour LED


The Red LED will be illuminated when the PoutR pin is made an output and is taken high while the PoutG pin is made an output and is taken low.

The Green LED will be illuminated when the PoutG pin is made an output and is taken high while the PoutR pin is made an output and is taken low.
                          Red
           _____     .----|>|----.
PoutR >---|_____|----|           |----.
             R       `----|<|----'    |
                         Green        |
                                      |
PoutG >-------------------------------'

Example Spin program for a LED on pin 0 (Red) and pin 1 (Green) ...
DIRA[0] := 1    ' Make pin 0 an Output
DIRA[1] := 1    ' Make pin 1 an Output
 
OUTA[0] := 1    ' Make Pin 0 high, and ...
OUTA[1] := 0    ' Make Pin 1 low,  Red LED on
 
OUTA[0] := 0    ' Make Pin 0 low,  and ...
OUTA[1] := 1    ' Make Pin 1 high, Green LED on
 
OUTA[0] := 0    ' Make Pin 0 low,  and ...
OUTA[1] := 0    ' Make Pin 1 low,  both LEDs off
 
OUTA[0] := 1    ' Make Pin 0 high, and ...
OUTA[1] := 1    ' Make Pin 1 high, both LEDs off