Photoresistor help
Hi,
I have boe-bot robot. on it ping and infrared head lights are also working. now i want when my robot go into low intensity light area it shutdown, means stop working.
·
I have boe-bot robot. on it ping and infrared head lights are also working. now i want when my robot go into low intensity light area it shutdown, means stop working.
·

Comments
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Parallax Tech Support·
, thephotoresistors remain in shadow. but when light falls on·robot it should wake up·
DO
SLEEP 60
GOSUB seethelight
LOOP UNTIL light > threshold
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
DO
SLEEP 60
GOSUB seethelight
LOOP UNTIL light > threshold
is it the complete code, i am little confused about subroutine·{·GOSUB seethelight} , please explaine
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
You can connect the photoresistor in series with a fixed resistor from Vdd to Vss, and the junction to a Stamp pin, so that PBASIC will read 1 on that pin in the dark and 0 in the light. You have to discover the correct value of fixed resistor or provide more information about your photoresistor.
fixedR photoR +5 ---/\/\---o---/\/\---- Vss | p0Then at the end of the main loop, add the lines marked with "<
":
Main: DO FREQOUT 8, 1, 38500 ' Emit 38.5 kHz IR To Left irDetectLeft = IN9 ' Store IR Detection Values FREQOUT 2, 1, 38500 ' Emit 38.5 kHz IR To Right irDetectRight = IN0 ' Store IR Detection Values IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN GOSUB Ping_Around ' Object Detected via IR Forward ELSEIF (irDetectLeft = 0) THEN GOSUB Ping_Around ' Object Detected via IR Left ELSEIF (irDetectRight = 0) THEN GOSUB Ping_Around ' Object Detected via IR Right ENDIF counter = counter + 1 ' Increment Passive Counter IF counter > 10 THEN ' Wait For 10 Servo Pulses GOSUB Ping_Out ' Activate PING))) ENDIF IF (distance > 30) THEN ' Is Object Farther Than 30 cm? GOSUB Forward_Pulse ' If Yes Go Forward ELSE GOSUB Ping_Around ' Otherwise Scan For Clear Path ENDIF dark PIN 0 ' <------- whatever pin you want to use for the light sensor DO WHILE dark ' <------- this will only execute when it is dark, pin level high SLEEP 60 ' <------- sleep in increments of 60 seconds LOOP ' <------- recheck for light once a minute, and back to work when light LOOP▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com