Reley help
pollack
Posts: 9
i just need some help on programming a reley . first i have this
' {$STAMP BS2}
' {$PBASIC 2.5}
Photo·········· PIN···· 0
lightLevel····· CON···· 200
light·········· VAR···· Word
Main:
· GOSUB Get_Light
· DEBUG HOME, "Light = ", DEC light, CLREOL
·· IF (light > lightLevel) THEN
· HIGH 0
· PAUSE 500
· LOW 0
· END if
· GOTO Main
Get_Light:
· HIGH 2
· PAUSE 5
· RCTIME 2, 1, light
what i am doing is hooking a reley up to a office lamp the thing is it works it turns on but it·clicks on and off. what i am attempting to do is make one of those lights that flick on when it gets dark in the room. so i just want some help in making stop·flashing. so when i put my hand·over the photocell i want it to turn on, it works when i do that but i just want·the light to stay until i remove my hand. i have to do this with the reley.
' {$STAMP BS2}
' {$PBASIC 2.5}
Photo·········· PIN···· 0
lightLevel····· CON···· 200
light·········· VAR···· Word
Main:
· GOSUB Get_Light
· DEBUG HOME, "Light = ", DEC light, CLREOL
·· IF (light > lightLevel) THEN
· HIGH 0
· PAUSE 500
· LOW 0
· END if
· GOTO Main
Get_Light:
· HIGH 2
· PAUSE 5
· RCTIME 2, 1, light
what i am doing is hooking a reley up to a office lamp the thing is it works it turns on but it·clicks on and off. what i am attempting to do is make one of those lights that flick on when it gets dark in the room. so i just want some help in making stop·flashing. so when i put my hand·over the photocell i want it to turn on, it works when i do that but i just want·the light to stay until i remove my hand. i have to do this with the reley.
Comments
' {$STAMP BS2}
' {$PBASIC 2.5}
CdS······· PIN····0
Bulb······ PIN····1·········
BulbOn···· CON··· 200
BulbOff··· CON··· 150
light······VAR····Word
·
Main:
· GOSUB Get_Light
· DEBUG HOME, "Light = ", DEC light, CLREOL
··IF (light > BulbOn) THEN
··· HIGH Bulb
··· PAUSE 500
··· DO
····· GOSUB·Get_Light
····LOOP UNTIL (light < BulbOff)
··· LOW Bulb
··ENDIF
· GOTO Main
·
Get_Light:
· HIGH·CdS
· PAUSE 5
· RCTIME CdS, 1, light
· RETURN
Notice the span between BulbOn and BulbOff -- this gives the program a bit of hysteresis so that·the bulb·doesn't osciallate when the light level is right around the threshold.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax