CS 1020 - Lab 4 - Advanced programming and concurrency

Start by creating a new program file "lab4.txt" in your CS1020 folder. Please do not simply tack on new code to an existing project - it's time to be neat, and you'll lose points if you're not! :) At the top of your new program, include your group number, your names, and "lab 4" in a comment. After we've had a chance to observe the progress on your cup collector robot, temporarily disconnect the handyboard from your robot (sorry!), and attach two switches (bump sensors) to digital inputs 7 and 8. Do not attach any motors, but simply observe the red and green motor LEDs for the exercises below.
  1. Write six procedures "p1" through "p6" that solve the 6 "challenges" at the bottom of page 18 of the course pack. Do not define any other procedures, but use the primitive commands ("a," "on", "off", "rd", "toggle", "switch 7", ...). Download your procedures as menu options 1-6 and test them. We will provide the instructors' Handy Boards with correct versions of these procedures as examples.

  2. Challenge 7 (extra credit) Write a procedure "p7" to implement the following behavior: Initially, motor a continually reverses its direction every 0.2 seconds (the green and red LEDs blink back and forth). Pressing switch 7 causes motor b to blink instead. Pressing it again switches back to motor a, and so forth. Again, you can observe this behavior on our sample Handy Boards.
When you are done, print out your code (and hand it in at the beginning of class on Wednesday). Then, you can go back to work on your cup collector robot. Hopefully you can put your new programming skills to use!