This is our first project with Arduino. We made a LED blink to the command of a switch.
These are series of images of the Arduino in action ( the video took too long to upload). We programmed the board to read the state of the switch and blink the LED on pin 13 if the reading is HIGH and turn the LED off If the Reading is LOW. We also programmed the board to read the state of the switch and blink 3 LEDs in to a pattern if the state of the switch is HIGH and turn the LEDs off if the state of the switch is LOW. The sketch and the schematic (the circuit diagram) for this will be available in the file cabinet.
Reading the switch to blink the LED.
When the state of the Switch is LOW don't blink the LED on pin 13. |
When the state of the Switch is HIGH blink the LED on pin 13. |
Blinking LED on pin 13. |
Random Blinking when the state of the switch is HIGH.
When the state of the switch is LOW don"t blink the LEDs. |
When the state of the switch is HIGH blink the LEDs in to a pattern. |
Janitha and Randipa Gunathilake.
11127@csc.school.nz
13107@csc.school.nz
Good work Janitha and Randipa - I'm glad that your Arduino arrived for you to work on during the holidays! Thanks for posting.
ReplyDeleteGreat work guys, when using the switch to control the led, did you wire it with a pull down resistor. If so great, If not this next bit should be useful. Electrical noise is when static electricity or some other magical force causes low voltage wires to become momentarily charged -if only for a few milli seconds-, wiring the switches ground to two pins, one through a resistor, means that when the switch is not pressed it will be pulled down the one pin, and when it is pressed the electrons will take the path of least resistance and go to the pin without the resistor, this means that your Arduino will never get a false reading. Jeremy Blum has a excellent tutorial for this on his YouTube channel. One of the sample sketches that is built into the Arduino Programming Environment contains a simple sketch that reads the state of a switch and displays it on the computer in binary.
ReplyDelete