In this project you will learn how to make an LED blink SOS signal
1. Upload the code below to the Arduino
2. Wire up your LED. The short leg of the LED will go to ground and the long leg will go to pin 13

3. Hit the reset button and enjoy
🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)
The standard "Blink" sketch teaches you how to turn a light on and off. The SOS Blink project is the essential step two: teaching you how to build a structural sequence to communicate information using timing.
Three Loops of Logic
The SOS signal is Dot-Dot-Dot (S), Dash-Dash-Dash (O), Dot-Dot-Dot (S). Writing 30 individual lines of digitalWrite() is terrible coding practice. You must use loops!
- The Global Variables:
int shortDelay = 200; int longDelay = 600; - Loop 1 (S):
for(int i = 0; i < 3; i++) {
digitalWrite(13, HIGH);
delay(shortDelay);
digitalWrite(13, LOW);
delay(shortDelay);
}
- Loop 2 (O): You copy the loop but swap
shortDelaytolongDelaywhen turning the LED on! - Loop 3 (S): You run the first loop again.
- The Reset: You add a massive 2000ms delay at the end before the main
loop()restarts, so listeners know the word has finished.
Why This Matters
By organizing the code like this, if you decide the signal is flashing too fast, you only change the number at the very top of the script int shortDelay = 400;. All the loops automatically inherit the fix!
Required Parts
- Arduino Uno/Nano (You can literally just use the onboard Pin 13 LED, requiring no wiring at all!).
- Optional: One LED, one 220-ohm resistor, and a buzzer.