Im really happy and excited to tell that iv completed building my first robot, but at the same time in sad as its not working properly. Actually its behaviour is some what different, Im posting videos with the program i downloaded on microcontroller.
Any help or comment is appreciated!!!
the program goes like this
symbol dangerlevel = 70
symbol turn = 300
symbol servo_turn = 700
main:
readadc 0, b1
if b1 < dangerlevel then
gosub nodanger
else
gosub whichway
end if
goto main
nodanger:
high 5 : high 6 : low 4 : low 7
return
whichway:
gosub totalhalt
gosub lturn
pause servo_turn
readadc 0, b1
gosub totalhalt
gosub rturn
pause servo_turn
readadc 0, b2
gosub totalhalt
if b1<b2 then
gosub body_lturn
else
gosub body_rturn
end if
return
body_lturn:
high 6 : low 5 : low 7 : high 4
pause turn : gosub totalhalt
return
body_rturn:
high 5 : low 6 : low 4 : high 7
pause turn : gosub totalhalt
return
rturn:
servo 0, 100
return
lturn:
servo 0, 200
return
totalhalt:
low 4 : low 5 : low 6 : low 7
Servo 0,150
wait 1
return
I have attached the video which clearly shows its behavior. what can i do to change it to function properly?
Your code looks fine but how about check the connections are good on the motors? And also going to the correct pins on the board, i have my left motor connect to both pins on A and the right motor is connected to B, you can swap the wires over if the motor is wrong direction but its just as easy to alter the code
the main problem i see is its not moving as shown in the video on start here page.
iv seen many other ppl who made this and its just working fine but this one is like moves a little stops but the servo keeps rotating left and right. i tried testing every part individually and they work fine but if i program them to work simultaneously they dont work like that.
wat i mean to say is i downloaded the program on microcontroller and im posting the video which shows how it works after writing that program on microcontroller.
From the video, it looks like your robot is getting stuck in the ‘whichway’ routine. It never seems to complete that routine and decide which way to go. The servo is also behaving funny. It turns more left than right and seems jerky.
Your robot could have a wiring problem, be affected by electrical noise, or have a power problem.
Power is easiest to check. What kind of batteries are you using? Are they brand new and/or fully charged?
In the start here instructions, under the ‘Programming’ section, did you verify that the sensor is putting out data on the b0 variable? Does the data change in relationship to the distance from the sensor to your hand as you move it back and forth?
You stated that you tested each part individually and they all work. Statements like that are not terribly useful to us. Something is wrong, and if it is something you overlooked, we cannot know that. So take us through what is really happening. Explain what you have tested and what the results were in some detail, and we’ll try to provide more assistance.