Hi,
I have created a circuit that reacts to light. When the light levels increase a LED dims and another set of LEDs increase in brigtness. One set of LEDs are Luxeon stars with their specific driver. The other is a set of LEDs that I bought seperatly, a plant grow, which I have hacked into.
I have got the circuit almost running the way I want it to. The only problem is that when it runs the Leds will sometimes flicker to the top brightness just for a split second. Does anyone know of a way of smoothing this out?
Here is my code and circuit diagram:
CODE....................................................
main:
readadc 1, b1 'reading what the light levels are
debug b1 ' show the value for the light level on the screen
'LED
w2 = 255 - b1
if b1 => 247 then goto off2 'The equation of a straight line, how does the led react to the light sensor value
pwmout 2,255,w2
'controlling the power coming from pin2 (if w2=0 then its off, if w2=255 then its full on)
'PLANT GROW
w1 = b1*3-531 'The equation of a straight line, how does the grow lights react to the light sensor value
if b1 =<178 then goto off1 ' if it is dark goto 'off1'
pwmout 1,255,w1
'controlling the power coming from pin1 (if w1=0 its off, if w1=255 its full on)
goto main
off1:
low portc 1 'Turn pwm1 off
goto main
off2:
low portc 2
goto main
END OF CODE................................................
and the diagram..................
I have created a circuit that reacts to light. When the light levels increase a LED dims and another set of LEDs increase in brigtness. One set of LEDs are Luxeon stars with their specific driver. The other is a set of LEDs that I bought seperatly, a plant grow, which I have hacked into.
I have got the circuit almost running the way I want it to. The only problem is that when it runs the Leds will sometimes flicker to the top brightness just for a split second. Does anyone know of a way of smoothing this out?
Here is my code and circuit diagram:
CODE....................................................
main:
readadc 1, b1 'reading what the light levels are
debug b1 ' show the value for the light level on the screen
'LED
w2 = 255 - b1
if b1 => 247 then goto off2 'The equation of a straight line, how does the led react to the light sensor value
pwmout 2,255,w2
'controlling the power coming from pin2 (if w2=0 then its off, if w2=255 then its full on)
'PLANT GROW
w1 = b1*3-531 'The equation of a straight line, how does the grow lights react to the light sensor value
if b1 =<178 then goto off1 ' if it is dark goto 'off1'
pwmout 1,255,w1
'controlling the power coming from pin1 (if w1=0 its off, if w1=255 its full on)
goto main
off1:
low portc 1 'Turn pwm1 off
goto main
off2:
low portc 2
goto main
END OF CODE................................................
and the diagram..................
Attachments
-
20.4 KB Views: 29