Let's Make Robots!

picaxe code

Hello.

I made a robot with two ir sensors for edge avoiding.

How do I say for example:

if b1 > 200 and b2 > 200 then

gosub address

 

and how do I say:

if w1 < 200 and b1 > 200 or b2 > 200 then

gosub address

 

Thank you.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

As Rik pointed out, this is something in the manual, specifically in manual 2 which you should be able to access in the programming editor. 

The sim is your greatest friend in terms of testing your code to see if it works. Don't upload code to your proc without letting the code run and loop several times. You may find surprises by doing this.

This is something your manual should be able to teach you. Make the smallest piece of code you can think of and make it work. Then make it larger, more complex.

Did you ever use the Picaxe simulator (F4) in the editor? That works much faster than actually ploading and testing bits of code in a real Picaxe.