Description
Our first lab was an introduction to Arduino software and to building circuits around our microcontroller. I modified the "Blink" sample sketch so that my LED blinked every half second (500 ms) at an interval of 2 seconds (2000 ms).
Components Used
1- Arduino Uno
1- Blue LED
1- 220 Ohm resistor
3- Jumper wires
1- USB cable
1- Breadboard
pin13->jumper wires->220 Ohm resistor->Blue LED-> jumper wire->GND
Code
//Code modified from Arduino software "Blink"
/*
Blink
Turns on an LED on for __ second(s), then off for __ second(s), repeatedly.
*/
//Pin 13 has an LED connected on most Arduino boards.
//give it a name:
int led = 13;
//the setup 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 half a second
digitalWrite(led, LOW); //turn the LED off by making the voltage LOW
delay(2000); //wait for 2 seconds
}
- Login to post comments