Exercise 1: Mega2560 Interface

List group members:


Instructions: as you complete each component, demonstrate to the instructor or the TA and have them sign off on it.


References:

C Development Environment

Note: Each person on team must be signed off on this step.

Adding Outputs

  1. Hardware: Double-stick tape your Arduino board to the prototype board (use a small amount of tape). Connect +5V power and ground to the power and ground busses on the protoboard
  2. Hardware: Connect at least four LEDs to different outputs (it is best if these are on the same port and contiguous pins)
  3. Software: Write a test program that shows that all LEDS work independently of one-another
  4. Software: Write a program that displays an interesting sequence of LED patterns

Adding Inputs

  1. Hardware: Connect another pin on the same port to +5V through a resistor. Connect this same pin through a "switch" directly to ground. In this case, our switch is two pieces of wire: one connected to ground, the other to the pin. To "close" the switch, we simply touch the two wires together.
  2. Software: augment your above program so that it does not start the LED sequence until after you close the switch

Reflex Game

  1. User sees 2 LED flashes
  2. The code waits for a random delay (use "random()" to draw a number)
  3. The code flashes once more
  4. If the user responds by closing the switch within 100 ms, then light one LED
  5. If the user responds within 150 ms, then light two LEDs
  6. Etc.
  7. After opening the switch, the game starts over.

Before You Leave...

Hand in this sheet


fagg@cs.ou.edu

Last modified: Tue Feb 22 00:19:16 2011