'------------------------------------------ 'sleepy.bs2 ' 'This high-level program uses the light sensor 'to control wake and sleep modes for the robot. 'You'll have to adjust the trip point to work 'for your sensor. lightl var word 'Light Level 'If dark then just sleep here main: gosub getll 'Get light level if lightl < 100 then wake 'Trip point 'sleep serout 8,396,["!1M1100001"] 'Stop the motor. sleep 1 'Sleep for 1 second goto main 'Loop forever. 'Wake wake: serout 8,396,["!1M1139999"] 'Move Forward goto main '------------------------------------------ 'getll 'Reads the light level and sets variable lightl getll: high 4 'Discharge cap pause 1 'Short delay rctime 4,1,lightl 'Capture light level return 'Done