Assignment: Introduction to Arduino and Physical Computing
Collaborators:
Description: Assignment 1
Materials: wires, LED, board
Project Code:
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
The circuit:
* LED connected from digital pin 13 to ground.
Created 1 June 2005 By David Cuartielles, adapted by Hazel Onsrud September 4, 2009
based on an orginal by H. Barragan for the Wiring i/o board
*/
int ledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}
// "TUI" will be flashed in morse code for as long as the device is on.
void loop()
{
// T in morse code
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
// U in morse code
digitalWrite(ledPin, HIGH); // set the LED on
delay(500); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(ledPin, HIGH); // set the LED on
delay(500); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
// I in morse code
digitalWrite(ledPin, HIGH); // set the LED on
delay(500); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(ledPin, HIGH); // set the LED on
delay(500); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}
See photos below for illustration.