TAKE THE SIGNAL OFF SCREEN

Arduino Morse Code

Create an Arduino Morse code sketch for an AVR Uno Rev3 or classic Nano.
Write a message, choose its speed, and download the file to blink the built-in LED.

Your message stays in your browser
5 / 2,000
Try:

A–Z, 0–9, and common punctuation. Spaces separate words.

SlowerFaster
Morse codeInternational Morse
.... . .-.. .-.. ---
5 characters · 2.9 seconds at 20 WPM

A space separates letters. A slash separates words. Learn the rhythm

Listen before uploading & other downloads
LowerHigher
SilentLouder
Flashing light: avoid if you are sensitive to flashing patterns. Limited to 7 WPM; set volume to 0% for a silent signal.
Keep your signal

Ready when you are. Audio downloads are limited to 120 seconds.

What you need

An AVR-based Arduino Uno (such as the Uno Rev3) or classic Nano, a suitable USB cable, and the Arduino IDE. This sketch uses LED_BUILTIN and assumes HIGH turns the LED on, as on these boards. No extra LED or wiring is needed on these boards. It needs adaptation for newer non-AVR boards such as the Uno R4 or Nano 33, which may also use different pins or inverted LED behavior.

Send your first message

  1. Write your message above and choose a speed. Audio volume and tone do not change the LED sketch.
  2. Choose “Download Arduino sketch” and open morse_message.ino in the Arduino IDE.
  3. Connect your board. Select its board type and USB port in the IDE.
  4. Upload the sketch. The built-in LED repeats your message with a seven-unit pause between repetitions.
  5. Change the message in the generator and download a new sketch when you want another pattern.

If you edit a downloaded sketch, use Diff Checker to compare the original and edited text side by side. This helps you see which lines changed before you upload it again.

A complete HELLO example

This example uses a 60 ms dot at 20 WPM. The LED uses the same dots, dashes, and pauses as the sound preview. Open the example below if you want to see the complete Arduino Morse code sketch before uploading.

View the Arduino sketch
// Morse Code Generator — morsecodegenerator.top
// AVR Arduino Uno / classic Nano: uses the built-in LED.
// No external wiring needed. Pattern is stored in flash, not limited SRAM.
// Speed: 20 WPM. Dot = 1200 / WPM milliseconds, rounded to nearest ms.
// Positive units: LED on; negative units: LED off.
#include <avr/pgmspace.h>

const unsigned int DOT_MS = 60;
const int8_t SIGNAL[] PROGMEM = { 1, -1, 1, -1, 1, -1, 1, -3, 1, -3, 1, -1, 3, -1, 1, -1, 1, -3, 1, -1, 3, -1, 1, -1, 1, -3, 3, -1, 3, -1, 3 };

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);
}

void loop() {
  for (unsigned int i = 0; i < sizeof(SIGNAL) / sizeof(SIGNAL[0]); i++) {
    int units = (int8_t)pgm_read_byte(&SIGNAL[i]);
    digitalWrite(LED_BUILTIN, units > 0 ? HIGH : LOW);
    delay(abs(units) * DOT_MS);
  }
  digitalWrite(LED_BUILTIN, LOW);
  delay(7UL * DOT_MS); // Pause between repeated messages.
}

Download this HELLO sketch. This example has not been tested on a physical board; check your board selection and built-in LED when you first upload it.

Why the pauses matter

Dots take one unit and dashes take three. Pauses inside a letter take one unit; pauses between letters take three; pauses between words take seven. The sketch stores complete pauses so they do not accidentally become four or eight units. Read the timing guide for worked examples.

If the sketch will not upload or the LED stays dark

  • No USB port: try a data-capable USB cable, reconnect the board, and check the port selection in the IDE.
  • Upload fails: confirm the exact board and processor selection. Some classic Nano boards need the “Old Bootloader” processor option; check the processor choice for your Nano.
  • Upload succeeds but no blinking: try the IDE’s built-in Blink example first. Confirm that your board has a built-in LED and uses the same on/off behavior as the Uno Rev3.
  • An AVR include error: this download is for AVR boards. Uno R4 and Nano 33 need a sketch adapted to their board libraries.

What this project does

The browser creates a file you upload through the Arduino IDE. It does not connect directly to your board. This is an LED sender, not a Morse receiver or buzzer project. Playback and sketch downloads allow messages up to 120 seconds at the selected speed. The sketch repeats your message and uses delay(), so it suits a simple LED project; a project that needs to handle buttons or sensors at the same time will need a non-blocking approach such as Arduino’s Blink Without Delay example.