Description
This lab was an introduction to physical computing in which an Arduino Uno microcontroller was used to make an LED blink. The circuit was very simple to construct but served to emphasize the topic of transdution. I used the Arduino programming environment to modulate the frequency of a blinking LED by changing the duration of the high and/or low voltage signal sent into the circuit from the microcontroller. These delay parameters can be seen below in the Code section with corresponding numerical values that represent time in milliseconds (ms). The code I used came from the "Blink" example sketch.
The circuit utilized a 220 ohm resistor and a blue LED. These components 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- Breadboard
1- 220 Ω Resistor
1- Light Emitting Diode (LED) (Blue)
1- Apple Mac Laptop Computer (OS X)
Code
/*
Blink (Arduino Example Sketch)
Turns on an LED on for __ ms, then off for __ ms, 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(500); // wait for specified time in ms (duration of LED on)
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for specified time in ms (duration of LED off)
}
Images
- Login to post comments