Friday, October 9, 2009

Exercise 3

Exercise 3


video




First, i give variables for the LED pin, the photo pin, and the 2 values. Then i set up 6 variables equal to eventually 6 different blinking patterns. in the void setup i set the LED pin to output, and the serial Statement. Now, in the void loop, i set photoValue to equal to analog read the photo pin when called. Light value will equal photovalue divided by 4 so that it can be read in between 0 and 8 i believe(depending on the resistor). Now, analog write the led pin to the photoValue, and print this. the next are 6 if statements saying if it is reading 1, do this speed, if 2, do this speed, and so on.. up to 6. Then the delay of 1 so that it does not read it as fast.

No comments:

Post a Comment