the “^” symbols indicate where the error is according to the program editor
main:
readadc 1, b1 ’ takes the voltage returned to analogue pin 1, and puts it into variable b1 debug ’ this draws out all variables to the editor.
goto main
the editor tells me theres a syntax error here:
into variable^b1 debug etc.
then it tells me there is one here also:
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
turn ^(depending on it’s speed etc.
then here:
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 return
most likely^need to adjust to etc.
then here:
body_lturn: high 6 : low 5 : low 7 : high 4 ’ this should be your combination that turns the robot one way pause turn : gosub totalhalt return
robot one^way
and last but not least:
body_rturn: high 5 : low 6 : low 4 : high 7 ’ this should be your combination that turns the robot the other way pause turn : gosub totalhalt return
the other^way
if you could explain these it would be most helpful
Almost all of these are caused by formatting issues. The comment operator (’) only works until the end of the line, so for comments that go onto the next line you need to add another comment operator symbol. Either that or just shorten the comment to pull it all onto the same line, some of your comments may have a premature line break (TWSS) from copying and pasting.
Long story short, if you get a syntax error in a comment, then the compiler isn’t treating the whole comment as a comment.
The single quote ‘ and the semi colon ; are used in Picaxe Basic to indicate a comment. Everything after ’ or ; is ignored until a new line begins.
The editor is displaying them in green. Perhaps your browser copied those single quote characters as something else? Or you copied it via a different editor, like MS Word. Some editors try to be “smart” about their quotation marks. Or your software is using a language that “translates” them into something else…
Try this snippet of code in a new program:
; this is a comment ’ so is this
; here is a label without comment here:
; there is a label with comment there: ’ blah
; command without comment pause 500
; command with comment wait 1 ’ edit oops, I forgot to put a comment here
; simple gosub call, add your own comments and experiment gosub something
goto there
; here is something to do something: pause 300 return
so just today my robot decides it deosnt want to connect with the program editor and yesterday it had no problem doing so. all im trying to do is set the sensor and it says i need to 1). connect the robot to my computer via serial cable 2). give the robot power via the battery pack or 3). reset the robot. i have connected the robot to the computer via serial cable. i have also put brand new batteries in the battery pack ( i also checked them with a battery checker) and i tried resetting the PICAXE but it wont connect so that it can reset. is there something i am doing wrong? could you help me trouble shoot this please =)