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 5 Challenges

Questions

  1. What kind of electrical connection is a whisker?
  2. When a whisker is pressed, what voltage occurs at the I/O pin monitoring it?  What binary value will the digitalRead function return?  If digital pin 8 is used to monitor the whisker circuit, what value does digitalRead return when a whisker is pressed, and what value does it return when a whisker is not pressed?
  3. If digitalRead(7)== 1, what does that mean?  What does it mean if digitalRead(7)== 0? How about digitalRead(5)== 1 and digitalRead(5)== 0?
  4. What statements did this chapter use to call different navigation functions based on whisker states?  
  5. What is the purpose of having nested if statements?

Exercises

  1. Write a routine that uses a single variable named whiskers to track whisker contacts.  It should store a 3 when no whiskers are contacted, a 2 if the right whisker is contacted, a 1 if the left whisker is contacted, or 0 if both whiskers are contacted.  Hint: multiply the result by two.
  2. Modify the loop function in RoamingWithWhiskers so that it makes the BOE Shield-Bot stop and not restart when both whiskers contact at the same time.
  3. Add a function named pause to RoamingWithWhiskers.  It should make the BOE Shield-Bot stay still for a certain amount of time. 
  4. Modify the loop function so that the BOE Shield-Bot stays still for 0.5 seconds before backing up and turning.

Projects

  1. Modify RoamingWithWhiskers so that the BOE Shield-Bot stops and makes a 4 kHz beep that lasts 100 ms before executing its usual evasive maneuver.  Make it beep twice if both whisker contacts are detected during the same sample.  HINT: Use the pause function you developed in the Exercises section to make it pause immediately after the tone starts playing.  Also, a 0.2 second pause after the tone call separates the 0.1 second tone from servo motion, or allows you to hear a second tone.   
  2. Modify RoamingWithWhiskers so that the BOE Shield-Bot roams in a 1 yard (or 1 meter) diameter circle.  When you touch one whisker, it will cause the BOE Shield-Bot to travel in a tighter circle (smaller diameter).  When you touch the other whisker, it will cause the BOE Shield-Bot to navigate in a wider diameter circle.

Printer-friendly version
Chapter 5 Summary
Prev
Chapter 5 Solutions
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

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

© 2025 Parallax Learn • Built with GeneratePress