Description
This laboratory exercise served as an introduction to both physical computing and to the Arduino programming environment. A simple circuit was constructed with a 220 Ω resistor, a light emitting diode (LED), a breadboard, and an Arduino Uno microcrontroller. The frequency of the LED blinking was modulated through the Arduino programming environment, by modifying the duration of the high/low voltage signals present in the "Blink" example code.
The components in the circuit were connected in series. The resistor was connected to pin 13 on the microcontroller, which lead into a node shared by the anode of the LED. The LED's cathode was grounded on the microcontroller to complete the circuit.
Components Used
1- Arduino Uno microcontroller
1- 220 Ω Resistor
1- Breadboard
1- Light Emitting Diode (LED) (Red)
1- Laptop (Mac OS X)
2 - Jumper wires
Code
/*
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(1000); // wait for a second. *Modified to 500 ms*
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second *Modified to 700 ms*
}
- Login to post comments