Homework due Tues, 2/20/01 Here's the scoop: Please do at least half of the problems, whichever ones seem interesting. We know this is jumping straight in, the point of this is to get you to browse through the reference book and dust off your programming skills a little, and give us a chance to see your programming style. Bring printouts in on Tuesday or email us your code, and we'll comment on it. Important note: Your code does not have to have the right syntax or be exactly right, we know most of you won't be able to compile it to check, we're looking for ideas and pseudo code here, (though if you send in correct C code that's fine too). --Max 1. Write a program that turns on an LED while a button is held down and off while the button is released. 2. Write a program that blinks an LED at one speed when a button is held down and at a different speed when the button is not being pressed. 3. Write a program that changes the state of an LED (on -> off, or off -> on) every time you press a button. Then modify the program so the LED does not change state until you release the button. 4. Write a program that counts from 0 to 15, in binary, on a row of 4 LEDs, incrementing once a second. Then modify it so it increments every time you press a button, instead. 5. Write a program that makes an output pin oscillate between 0 and 5 volts at a frequency of 1 kHz. (for producing a high-pitched squeal from a speaker, for example). 6. Write a program that continuously reads an analog sensor and stores the 20 most recent values in an array (this is basically one of the sample C programs handed out Wednesday). In addition, have the program print out the average of the last 20 values every time it reads a new value. (Bonus points for doing this with as little computation as possible). 7. Write a program that reads a light sensor and turns on an LED if the light level is below some level (a "night light"). Then adapt it so that once the LED is on, it doesn't turn off unless the light gets much brighter (to keep the LED from rapidly flickering on and off when the light sensor is right at the critical value). 8. Write a program that waits for you to press the button twice, then tells you how much time elapsed between your two button presses (a stopwatch). Then add a second button with "Lap" functionality (if you are not familiar with the Lap/Split button on a stopwatch, don't worry about this one).