Utilizing the “Blink” example sketch from the Arduino software, a simple circuit to make a LED light blink at specific intervals and durations was created. This lab served as an introduction to basic circuit wiring and introduced the concepts of a basic microcontroller circuit; namely a power source, load, microcontroller and ground.
Using an Arduino Uno microcontroller, 220 ohm resistor, Red LED, 22 gauge solid core wire, and a solderless breadboard a series circuit was wired as shown in Figure 1. Using pin 13 as the output from the microcontroller, the circuit’s current went through the 220 ohm resistor, then the LED and then returned to ground on the microcontroller. The microcontroller was programmed with the “Blink” example sketch code show below. In this coding the digitalWrite(,) command was used to alternate between a state of High voltage i.e. LED on, and low voltage i.e. LED off, while the delay() command specified how long these commands remained unchanged (in miliseconds) before the program advanced to the next step in the loop. To confirm that the program was successfully updated, the High voltage delay command was altered to 5000 ms.
Components Used
· 1- Arduino Uno microcontroller
· 1- Breadboard
· 1- 220 ΩResistor
· 1- Light Emitting Diode (LED) (Blue)
· 2 – 22 gauge wire
· Windows Arduino open source software
Code: Arduino “Blink” sketch
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// 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(5000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
- Login to post comments