Description: The purpose of the lab was to create a simple LED blinking circuit using the Arduino. I created a simple SOS sequence corresponding to morse code. This consisted of creating a series of three short blinks ("dots") followed by a series of three longer blinks ("dashes") followed by the original three short blinkes ("dots").
- Components Used:
- Breadboard
- Arudino Uno
- 1 220 Ohm Resistor
- 3 wires
- USB Power-source
- Red LED
Code:
int led = 13;
void setup() {
pinMode(led, OUTPUT);
}
void loop (){
// dot dot dot blink
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
// pause
delay(200);
// dash dash dash blink
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
delay(200);
// dot dot dot blink
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
//pause
delay(1000);
}
- Login to post comments