Skip to main content

1.6

by Tech Camp

Introduction

Using some switch sensors and clever coding, let's make your robot safely navigate the Martian rock fields!

  1. Hopefully your robot now makes it across the rock field fairly well - but only if the obstacle is directly in front.
    • Hopefully your robot now makes it across the rock field fairly well - but only if the obstacle is directly in front.

    • You might find it gets stuck with obstacles on the left and right - but we have two switch sensors, so we can upgrade the robot to fix that!

    • Put your other switch module onto your robot, and move the first one so it looks like the picture.

  2. Let's test the left sensor.
    • Let's test the left sensor.

    • When the left switch is pressed, the robot should reverse and turn right to avoid the obstacle.

    • Try building the program in the picture and test your program!

    • Don't forget, you might need to adjust how far the robot turns and reverses for it to work well.

  3. Now let's test the right switch.
    • Now let's test the right switch.

    • Change the program so it checks the right sensor, and then turns left to avoid the obstacle!

  4. Change your one switch code from the last challenge so both switches are being checked. Make sure that when the left switch is hit, the robot reverses and then turns to the right,  (away from the obstacle) and when the right switch is hit it reverses and then turns to the left.
    • Change your one switch code from the last challenge so both switches are being checked.

    • Make sure that when the left switch is hit, the robot reverses and then turns to the right, (away from the obstacle) and when the right switch is hit it reverses and then turns to the left.

    • Test your program properly in the rock field, and try to adjust the wait times so it works as well as possible!

    • There's some example code in the picture if you need a hint - but it is missing a lot of blocks you will need to fill in!

  5. Let's add some more feedback to the robot so we know what its doing.
    • Let's add some more feedback to the robot so we know what its doing.

    • Add the LED and buzzer modules to your robot, and plug them into the last two letters - you will only be able to plug in the green LED as there will be no spaces left.

    • Add blocks to your program so that:

    • When driving forwards, the green LED is on.

    • When an obstacle is hit and the robot is reversing and turning, the green LED is off.

    • When the robot is reversing, the buzzer should beep to warn people to get out of the way!

    • If you can, try to make the buzzer beep several times as the robot is reversing instead of being on all the time.

Finish Line

One other person completed this guide.

Tech Camp

Member since: 10/03/2012

119 Guides authored

Team

Tech Camp Staff Member of Tech Camp Staff

6 Members

140 Guides authored