LED Driver Program

The program is implemented as a loop which starts by measuring the photocell input voltage. It is a photo-resistor connected to Vdd, and a 15 kilohm resistor to Vss. If the voltage exceeds an upper threshold then the blue pairing LED lights and the dial light is extinguished. If the voltage is less than a lower threshold then the blue pairing LED goes off and the dial light goes on. The thresholds are loaded as constants for tailoring.

#rem Blue_LED.bas    


Subsystem for GE 1941 radio bluetooth speaker to operate a blue LED when paired


The dial light turns off when paired


John Saunders 10/24/2016


#endrem


#picaxe 08M2




'Input port


symbol Photocell_Port = C.4    'Light makes higher voltage, 15 kilohm pulldown




'Output ports


symbol Dial_Port    = C.2    'High provides 40 MA to two dial lights


symbol LED_Port      = C.1    'High provides 10 MA to the blue LED




'Constants


symbol On_Threshold   = 150    '> Enables pullin


symbol Off_Threshold  = 75    '< Drops out




'Variables


symbol Photocell      = b2    'Analog photocell input




init:


SETFREQ m4


LOW LED_Port


LOW Dial_Port 






main:


READADC Photocell_Port,Photocell


IF Photocell > On_Threshold THEN


    LOW Dial_Port


    HIGH LED_Port


ENDIF


IF Photocell < Off_Threshold THEN


    LOW LED_Port


    HIGH Dial_Port 


ENDIF


PAUSE 100


GOTO main