Assignment: Assignment 1
Collaborators: jonyen
Description
Made an LED blink using the Arduino microcontroller.
Components
LED
220 Ohm resistor
Arduino Code
/*
* Blink
*
* The basic Arduino example. Turns on an LED on for one second,
* then off for one second, and so on... We use pin 13 because,
* depending on your Arduino board, it has either a built-in LED
* or a built-in resistor so that you need only an LED.
*
* http://www.arduino.cc/en/Tutorial/Blink
*/
int ledPin = 13; // LED con
nected to digital pin 13
void setup() // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop() // run over and over again
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(200); // waits for a tenth of a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(200); // waits for a tenth of a second
digitalWrite(ledPin, HIGH); // sets the LED on
delay(200); // waits for a tenth of a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(200); // waits for a tenth of a second
digitalWrite(ledPin, HIGH); // sets the LED on
delay(200); // waits for a tenth of a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(200); // waits for a tenth of a second
digitalWrite(ledPin, HIGH); // sets the LED on
delay(2000); // waits for 2 seconds
digitalWrite(ledPin, LOW); // sets the LED off
delay(2000); // waits for 2 seconds
digitalWrite(ledPin, HIGH); // sets the LED on
delay(2000); // waits for 2 seconds
digitalWrite(ledPin, LOW); // sets the LED off
delay(2000); // waits for 2 seconds
digitalWrite(ledPin, HIGH); // sets the LED on
delay(2000); // waits for 2 seconds
digitalWrite(ledPin, LOW); // sets the LED off
delay(2000); // waits for 2 seconds
}
Image