3. Digital Input/Output

Due Thursday, September 17 2009 (23:59 Eastern time)

This exercise has four (4) parts.  (you may want to refer to the class notes for digital input-output)

1. Design, build, and test a digital sensor (switch).  You may use this switch (or any other) in the following exercise.

2. Design a circuit with two digital sensors and three LEDs. The program has a counter variable, which controls how fast the LEDs blink.   If that variable’s value is zero, the LEDs blink slowly (say, on a 5 second period).  If the variable’s value is 1, they blink faster; 2, even faster, etc.

Call one switch Reset, call the other switch Step.

When you press the Reset switch, the program resets the counter to zero. Every time you press the Step switch, the program will count (add one to the counter variable). This should make the LEDs blink faster.

3. Using the same two-switch circuit, write a different program. Write a program to turn the LEDs on to display the (2-bit) binary number that the switches represent. (see the table below).  (hint: see the boolean operators && and || )

3 LEDs Switch 1 Switch 0
O O O Off off
O O X Off on
O X X On off
X X X On on

4. Mashup programs #2 and #3:   in addition to blinking the LED as in #2, let the LEDs also display the value of the counter variable (from zero to three), as in #3.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: