Let's Make Robots!

I got trouble with the programming.

Hey guys, I'm new to this website and I have been building robots before and this website has been inspiring to me. :)
Yet, I have been building four robots: 2 of them are Fritsl's design, the "start here" and "little 8" and the other 2 are my own design. Now here's the problem, the little 8 robot is fine and so is one of my design with the parallax ping sensor., but with the other 2 the "start here" with the sharp sensor and my other design with the SRF005 sensor. I have been working on their programming for days and all they can do is move their servo. and move an inch forward and backwards. I was super super close to getting into the correct programming by moving them around and trying to get these robots to life like how you guys have them done in videos. I've looked around all over the website for ideas on how to fix the programming. Sorry if i had to borrowed yours, like I said, I'm new to this website and I'm still learning the basics. If you guys got any ideas to help me with my robots and not make them move only forward and backwards one inch, please your comments below

thank you in advance :). 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Can you post your code?

Actually they are the basic codes which works fine. It's just that when it comes to the sensor codes the whole thing just stops and only the sensors just works nothing else. But when I delete the sensor codes everything else is functioning again. 
Like here:
I input the basic from "How to build your first robot":

 servo 0, 150

wait 2


servo 0, 75

wait 2

servo 0, 225

wait 2

servo 0, 150 

wait 2


main:                 <------------------when it comes to here thats what I was having a big issue making me move this code around as well                                               as the SRF005 code. Does it go with the small programming Fritsl give us or does it go somewhere                                               else. And oh yeah, there's also something else. I input the codes and there's this bug telling me                                                      about an error of this programming      

readadc 0, b0


goto main


high 4

low 5


high 6

low 7

servo 0, 75 wait 2


servo 0, 225 wait 2

servo 0, 150 wait 2

Symbol dangerlevel = 70 ' how far away should thing be, before we react?
symbol turn = 300 ' this sets how much should be turned
symbol servo_turn = 700 ' This sets for how long time we should wait for the servo to turn (depending on it´s speed) before we measure distance

main: ' the main loop
readadc 0, b1 ' read how much distance ahead
if b1 < dangerlevel then
gosub nodanger ' if nothing ahead, drive forward
gosub whichway ' if obstacle ahead then decide which way is better
end if
goto main ' this ends the loop, the rest are only sub-routines

nodanger:' this should be your combination to make the robot drive forward, these you most likely need to adjust to fit the way you have wired your robots motors
high 5 : high 6 : low 4 : low 7

gosub totalhalt ' first stop!

'Look one way:
gosub lturn ' look to one side
pause servo_turn ' wait for the servo to be finished turning
readadc 0, b1
gosub totalhalt

'Look the other way:
gosub rturn ' look to another side
pause servo_turn ' wait for the servo to be finished turning
readadc 0, b2
gosub totalhalt

' Decide which is the better way:
if b1<b2 then
gosub body_lturn
gosub body_rturn
end if

high 6 : low 5 : low 7 : high 4 ' this should be your combination that turns the robot one way
pause turn : gosub totalhalt

high 5 : low 6 : low 4 : high 7 ' this should be your combination that turns the robot the other way
pause turn : gosub totalhalt

servo 0, 100 ' look to one side

servo 0, 200 ' look to the other side

low 4 : low 5 : low 6 : low 7 ' low on all 4 halts the robot!
Servo 0,150 ' face forward
wait 1 ' freeze all for one second






Your robot won't move at all. The servo connected to pin0 will move back and forth a few times, then you will be stuck in an endless loop of reading the sensor that is connected to, if I recall correctly, pin0. There is no sensor connected to that pin, so, your robot will do very little at all.

Put another way, everything after goto main is extraneous aka not needed/used.

I failed to see that you have what looks to be two separate programs listed.

Maybe you could let us know what chip you are writing the program for?

ok thank you:) i got it up and running.