Start here bot code

fritl's code didnt work with my start  here bot so i re-wrote it and my bot did the same thing that it did with frits'. it just sits there turning its head from side to side

i could not get the sharp sensor test to work... the value just stays the same

heres my code.. can you post any mistakes in it.... thanks

symbol dangerlevel= 65
symbol turn= 300
symbol servo_turn= 700

main:
readadc 0, b0
if b0< dangerlevel then
gosub nodanger
else
gosub whichway
end if
goto main

nodanger:
low 4:high 5:low 6:high 7
return

whichway:
gosub totalhalt
gosub left_turn
pause servo_turn
readadc 0, b0
gosub totalhalt
gosub right_turn
pause servo_turn
readadc 0, b1
return
if b1<b2 then
gosub left_body_turn
else
gosub right_body_turn
end if
return

totalhalt:
low 4
low 5
low 6
low 7
servo 0, 150
wait 1
return

left_turn:
servo 0, 0
return

right_turn:
servo 0, 250
return

left_body_turn:
low 4 high 5
pause turn: gosub totalhalt
return

right_body_turn:
low 6
high 7
pause turn: gosub totalhalt
return

I haven’t been working

I haven’t been working with PICAXE for a while but is this corrct?
nodanger:
low 4:high 5:low 6:high 7
return


Shouldn’t it be


nodanger:
low 4
high 5
low 6
high 7
return


Else, have you run the debugger and checked the values from the sensor?

Code

Geir is correct with his code sample. You can have the commands grouped together but you must have a space between colon and next command.   low 4: high 5: low 6: high 7

The simulator will give you an error with the code you have now. 

Try either method and see what happens.

its fine

nope… i just ran that code and it works fine… all you need is a space after the colon, but your method works just fine

thanks.

ps… sorry about the lack of capitols. i got an arthroscopy two days ago so im typing one handed

thanks

it turns out my code was fine except for that… its just that my ir sensor is burnt out… though it does give me the opportunity to upgrade to the SRF05, so YAY!

Lemme guess…

You are using a 28x board (the start here board) and you are using a servo connector to plug into the ADC, right? Yup, I fried 4 sharps at once doing this. --The data pin is in the center of the ADC pins on that board. It is different than the 8 outputs on the other side.

what

i dont know what your talking about… sorry im kind of new at this… i didnt have plastic around the bottom of the sharp wires so they were touching when i ran the current through them… would that burn them out???

We need a picture

Please post a picture of your set-up.

start here bot

its exactly the same as frits’ except i have the single resistor, tamiya double gearbox and its mounted on the tamiya track and wheel set

no.

It is not exactly the same as frit’s. Frits didn’t fry his sharp sensor. We need a clear picture of your set-up so we can be sure you connected everything right.