Walter the Sonar Bot

Introduction: Walter the Sonar Bot

We will program Walter's Sonar

Step 1:

This a video tutorial following the instructable steps.

Step 2:

We will modify the Walter microbot code so we can have a working sonar.

Step 3:

Open the inputs tab and select On Button Press command which I have highlighted.

Step 4:

We will need 2 of these commands, make sure to change one of the buttons to B and leave the other on A.

Step 5:

Open the variables tab and click on make a variable

Step 6:

When you click on make a variable it will ask you to name it to make things simple just name it Button and then press ok, then you should see 3 commands appear.

Step 7:

Drag the Set Button command to On Button command like I showed.

Step 8:

Open the logic tab and grab the command that I highlighted.

Step 9:

Replace the Button Command with the new command.

Step 10:

Select the button variable and replace the first 0. It might take you a couple of tries to get it to snap to the right stop.

Step 11:

Open the variable tab and we will be making a new variable named Sonar.

Step 12:

Go to extensions and search for sonar and choose the one i highlighted.

Step 13:

Grab the set Sonar command and drag it under the if statement.

Step 14:

Drag the Sonar command into the sonar variable.

Step 15:

Next we will change the variables in the sonar command.

Step 16:

Open logic tab and drag the if else command under the Sonar command.

Step 17:

Open logic tab and drag the <0=0> command to replace the true statement.

Step 18:

Drag the Sonar Variable and replace the true statment.

Step 19:

Drag the continuous servo command under the second if statement.

Step 20:

Click on advanced and then open the control tab. Then drag it under the first 2 continuous servo commands.

Step 21:

Drag the second set of continuous command under the wait command.

Step 22:

Add a wait time under the second set of continuous servo command. Then drag the third set of continuous commands under the first else command.

Step 23:

Delete the other statements and leave the else if statement and the stop servo commands.

Step 24:

Drag the stop servo command under the else if statement.

Step 25:

Open the logic tab and drag a <0=0> command to the slot.

Step 26:

Drag a button variable to replace the 0

Step 27:

Now were going to change some of the variables.

Step 28:

This is what the finished code should look like.

Step 29: Step 20: Here Are Video Instructions If You Prefer That! :)

Be the First to Share


    • Microcontroller Contest

      Microcontroller Contest
    • Cheese Challenge

      Cheese Challenge
    • Fried Food Challenge

      Fried Food Challenge