My first carpet rover with 3 bumper switched

i have build a carper rover from clear lexan, i have added 3 bumper switches, 1 to ‘see’ an object on the left, 1 to ‘see’ an object on the right and 1 to ‘see’ an object in the middle. I have also added a blue led, with lightups the lexan very nice.

When to program start, the blue led will blink every half second. until the middle bumper or Button A is activated. Then the blue led will lightup and the carpet rover will start moving.

When the left or right bumper becomes active the carper rover moves back and then rotates 90 degrees. When the middle bumper is active, the carper rover moves back, and then rotates 180 degrees. During the time that the carpet rover is moving back and rotating the blue led will blink very fast.

Below you will find the programm with a made:

[code]main
x var word
y var byte
servo1 var word
servo2 var word
stop1 con 1500
stop2 con 1500

switch: 'button A active, then activate drive program
y=0
high p15
button p4,0,255,0,Y,1,drive
pause 500
low p15
button p4,0,255,0,Y,1,drive
pause 500
goto switch

drive:

pause 1000 '1 second delay
goto moveforward

moveforward: 'slow start servo’s
high p15
servo1 = stop1
servo2 = stop2

for x = 1 to 300
  servo1 = servo1 - 1
  servo2 = servo2 + 1

y=0
button p4,0,255,0,Y,1,middle
button p5,0,255,0,Y,1,left
button p6,0,255,0,Y,1,right

gosub servocontrol

next

fullspeed: 'full speed
high p15
servo1 = 1300
servo2 = 1700

y=0
button p4,0,255,0,Y,1,middle 'middle bumper active, drive back and turn
button p5,0,255,0,Y,1,left 'left bumper active, drive back and turn
button p6,0,255,0,Y,1,right 'right bumper active, drive back and turn

gosub servocontrol
goto fullspeed

right:
servo1 = stop1 'stop move forward servo1
servo2 = stop2 'stop move forward servo2

gosub servocontrol

for x = 1 to 100
servo1 = servo1 + 1 'move back
servo2 = servo2 - 1 'move back
toggle p15

gosub servocontrol

next
servo1 = stop1 'stop move back servo1
servo2 = stop2 'stop move back servo2
gosub servocontrol

for x = 1 to 100 'turn right 90 degrees
servo2 = servo2 + 1
toggle p15
gosub servocontrol 'end turn

next

goto moveforward

left:
servo1 = stop1 'stop moveforward servo1
servo2 = stop2 'stop moveforward servo2
low p15
pause 500
high p15
pause 500
gosub servocontrol

for x = 1 to 100
servo1 = servo1 + 1 'move back
servo2 = servo2 - 1 'move back
toggle p15

gosub servocontrol

next
servo1 = stop1 'stop move back servo1
servo2 = stop2 'stop move back servo2
gosub servocontrol

for x = 1 to 100 'left turn 90 degrees
servo1 = servo1 - 1
toggle p15
gosub servocontrol ’ end turn

next

goto moveforward

middle:
servo1 = stop1 'stop moveforward servo1
servo2 = stop2 'stop moveforward servo2
low p15
pause 500
high p15
pause 500
gosub servocontrol

for x = 1 to 100
servo1 = servo1 + 1 'move backward
servo2 = servo2 - 1 'move backward
toggle p15

gosub servocontrol

next
servo1 = stop1 'stop move backward servo1
servo2 = stop2 'stop move backward servo2
gosub servocontrol

for x = 1 to 150 'turn 180 degrees
servo1 = servo1 - 1
toggle p15
gosub servocontrol ’ end

next

goto moveforward

servocontrol: 'servo control

 pulsout p2,servo1
 pulsout p3,servo2

pause 20
return

end[/code]

Do you have any plans on making the rover remote control?

hello Jpup,

i do not have any plans, to make the rover remote controllable. Fot me, this was just a test robot, with i used to try programming a basic atom