This is a light follower robot that stops in front of objects.
Its made from a Microbot from Picaxe.
Code:
symbol left = b9
symbol right = b7
symbol difference = b4
main:
if pinC.6 = 1 then
halt A
halt B
wait 2
endif
readadc 7, left
readadc 9, right
pause 10
pulsout C.2, 2
pulsin C.2, 1, w0
w1 = w0 * 5 / 58
if w1 < 10 then
halt A
halt B
goto main
endif
if left > right then
difference = left - right
if difference >= 10 then
halt B
forward A
else
forward A
forward B
endif
else
difference = right - left
if difference >= 10 then
forward B
halt A
else
forward A
forward B
endif
endif
goto main
Follow Light Stop in front of Object
- Actuators / output devices: motors
- Control method: auto
- CPU: Picaxe 20x2
- Operating system: Windows
- Power source: 3 AAA
- Programming language: Basic
- Sensors / input devices: LDR and SRF005
- Target environment: indoor
This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/my-first-ever-robot-i-got