Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Robotics with the Board of Education Shield for Arduino

Robotics with the Board of Education Shield for Arduino

Testing the Left and Right Wheels

Testing the Right Wheel

The next example sketch will test the servo connected to the right wheel, shown below.  The sketch will make this wheel turn clockwise for three seconds, then stop for one second, then turn counterclockwise for three seconds.

Example Sketch: RightServoTest

  • Set the BOE Shield-Bot on its nose so that the drive wheels are suspended above the ground.
  • Connect the programming cable and battery pack to the Arduino.
  • Enter, save, and upload RightServoTest to your Arduino
  • Set the 3-position switch to position-2 and press/release the RESET button.
  • Verify that the right wheel turns clockwise for three seconds, stops for one second, then turns counterclockwise for three seconds.
  • If the right wheel/servo does not behave as predicted, see the Servo Troubleshooting page.
  • If the right wheel/servo does behave properly, then keep going.
/*
 * Robotics with the BOE Shield - RightServoTest
 * Right servo turns clockwise three seconds, stops 1 second, then
 * counterclockwise three seconds.
 */

#include <Servo.h>                           // Include servo library
 
Servo servoRight;                            // Declare right servo
 
void setup()                                 // Built in initialization block
{
  servoRight.attach(12);                     // Attach right signal to pin 12

  servoRight.writeMicroseconds(1300);        // Right wheel clockwise
  delay(3000);                               // ...for 3 seconds
 
  servoRight.writeMicroseconds(1500);        // Stay still
  delay(1000);                               // ...for 3 seconds

  servoRight.writeMicroseconds(1700);        // Right wheel counterclockwise
  delay(3000);                               // ...for 3 seconds
 
  servoRight.writeMicroseconds(1500);        // Right wheel counterclockwise

}  
 
void loop()                                  // Main loop auto-repeats
{                                            // Empty, nothing needs repeating
}

Your Turn – Testing the Left Wheel

Now, it’s time to run the same test on the left wheel as shown below.  This involves modifying the RightServoTest sketch.

  • Save RightServoTest as LeftServoTest.
  • Change Servo servoRight to Servo servoLeft.
  • Change servoRight.Attach(12) to servoLeft.Attach(13).
  • Replace the rest of the servoRight references with servoLeft.
  • Save the sketch, and upload it to your Arduino.
  • Verify that it makes the left servo turn clockwise for 3 seconds, stop for 1 second, then turn counterclockwise for 3 seconds.
  • If the left wheel/servo does not behave as predicted, see Servo Troubleshooting.   
  • If the left wheel/servo does behave properly, then your BOE Shield-Bot is functioning properly, and you are ready to move on to Activity 3: Start-Reset Indicator.

Printer-friendly version
Activity 2: Re-test the Servos
Prev
Servo Troubleshooting
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress