Lab 1: Blinking LED
Description:
To familiarize ourselves with building circuits and the Arduino hardware/software. In this lab, we use the Arduino micro-controller to control an LED and make it blink at different rates, depending on what we code.
Components Used:
- LED
- Arduino Micro-controller
- Resistor
- Wires/Bread Board
Arduino Code:
/*
** Blink **
* Turns an LED on and off with varying time(different speeds depending on what we code) repeatedly.
* In this case, it is on for .5 sec and off for 1.25 sec.
* -- Taken from the Blink example --
*/
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(500); // wait for .5 second (LED on)
digitalWrite(13, LOW); // set the LED off
delay(1250); // wait for 1.25 seconds (LED off)
}
(1 vote)