SOS blink
Using the Arduino Software I was able to code two LED lights to blink at different intervals; One blinking at a steady rate, the other blinking the morse code pattern for “SOS”.
Below is a video of the lights and the code used to create the patterns.
CODE:
int x;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
Serial.begin(9600);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
//digitalWrite(12, LOW);
delay(200); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
//digitalWrite(12, HIGH);
delay(200); // wait for a second
x = x + 1;
if (x >= 1) {
digitalWrite(12, HIGH);
delay(100);
}
if (x == 3) {
digitalWrite(12, LOW);
}
if (x == 6) {
digitalWrite(12, LOW);
}
if (x >= 9 ) {
digitalWrite(12, LOW);
}
if (x >= 12) {
digitalWrite(12, LOW);
x = 0;
}
Serial.println(x);
}