ELSEIF to turn a light on or off
Shadowcasterx4ffc
Posts: 13
I'm using the DS1302 as the real time chip.
I'm trying to write an ELSEIF which I would like to use to turn a light on and off. I'm writing something which is not correct.
I would like the light to come on at 8am and go off at 9pm
if hour > x then
high 14
elseif hour < x then
low 14
else ?
endif
If anyone can help that would be great
thanks,
chris
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greenhouse Project
Post Edited (Shadowcasterx4ffc) : 6/20/2008 2:21:49 PM GMT
I'm trying to write an ELSEIF which I would like to use to turn a light on and off. I'm writing something which is not correct.
I would like the light to come on at 8am and go off at 9pm
if hour > x then
high 14
elseif hour < x then
low 14
else ?
endif
If anyone can help that would be great
thanks,
chris
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greenhouse Project
Post Edited (Shadowcasterx4ffc) : 6/20/2008 2:21:49 PM GMT
Comments
You didn't describe any of the rest of your program or the hardware involved. Assuming that you read an external
real time clock at least once a second (into hour)
This works because hour will be 8 for one hour and it doesn't matter if you do a high if the pin is already high or
a low if the pin is already low.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Sorry for the confusion, we're using the DS1302 as our timekeeping chip.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greenhouse Project
IF hour > 8 AND hour < 21 THEN HIGH light ELSE LOW light
Is there some particular reason you want to use ELSEIF?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com