program test {
#include
#include
#include
#include
sensor light1 on 1
light1 is light as percent
event lDark_light1EventLow when light1.low
macro LEFTTURN {
direction [ C ] [ A ]
off [ A ]
on [ A C ]
wait 100
float [ A C ]
}
macro RIGHTTURN {
direction [ A ] [ C ]
off [ C ]
on [ A C ]
wait 100
float [ A C ]
}
main {
ext InterfaceType "kFreestyle"
rcx_ClearTimers
bbs_GlobalReset([A B C])
try {
forever {
if light1 < lDark_light1EventLow.low {
bb_Backward(A, C, 15)
LEFTTURN
if light1 < lDark_light1EventLow.low {
bb_Backward(A, C, 15)
LEFTTURN
}
else
{
bb_Forward(A, C, 1)
}
bb_Forward(A, C, 50)
RIGHTTURN
}
else
{
bb_Forward(A, C, 10)
}
}
} retry on fail
}
}
|