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

Chapter 8 Solutions

Question Solutions

  1. The relative sensitivity at 35 kHz is 30%.  For 36 kHz, it’s 50%.
  2. Precede a variable declaration with the const keyword.
  3. A for loop that starts indexing at 38000 and increases by 1000 with each repetition.
  4. A summing junction is a part of a block diagram that indicates two inputs are added together (or one subtracted from another) resulting in an output.
  5. The error term is the measured level subtracted from the desired set point level.
  6. If a distance sample is taken with each repetition of the loop function, then the delays more or less determine how long it takes between each sample.  That’s called the sample interval, and 1 ÷ sample interval = sampling rate.

Exercise Solutions

  1. Just reduce the for statement’s condition from f <=42000 to f <= 41000
  for(long f = 38000; f <= 42000; f += 1000) {
    distance += irDetect(irLedPin, irReceivePin, f);
  }
  1. Declarations
const int setpoint = 2;    // Target distances
const int kpl = -45;       // Proportional control constants
const int kpr = -55;

Project Solution

  1. One quick and simple solution would be to average the driveLeft and driveRight values in the FollowingShieldBot sketch.  The resulting single value can be applied both left and right speed parameters in the maneuver call.
void loop()                          // Main loop auto-repeats
{
  int irLeft = irDistance(9, 10);    // Measure left distance
  int irRight = irDistance(2, 3);    // Measure right distance
 
  // Left and right proportional control calculations
  int driveLeft = (setpoint - irLeft) * kpl;     
  int driveRight = (setpoint - irRight) * kpr;
 
  int drive = (driveLeft + driveRight)/2; // Average drive levels
 
  maneuver(drive, drive, 20);        // Apply same drive to both
 
  delay(10);                         // 0.1 second delay
}

Printer-friendly version
Chapter 8 Challenges
Prev

DISCUSSION FORUMS | PARALLAX INC. STORE

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

© 2025 Parallax Learn • Built with GeneratePress