Description:
The goal of this assignment was to learn to program the Arduino Uno to make an LED blink. Example code provided by Arduino was modified for this assignment. In the original code, the LED blinks for one second then there is a one second wait then it blinks again. In the modified code, the LED blinks for one second then there is a three second wait and then it blinks again.
The only difficulty I encountered when completing this assignment was due to the fact that I am still learning how to program the Arduino. At first, my program wouldn't upload because I didn't have the correct device identified for the upload. This problem was solved after consulting the instrucions provided on the Arduino site.
Components Used:
1 - Arduino Uno
1 - Breadboard
1 - 220-ohm Resistor
1 - Red LED
Code
/*
Blink
Turns on an LED on for one second, then off for three seconds, repeatedly.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(3000); // wait for 3 seconds
}
- Login to post comments