CW Callsign Flasher

This code will run on just about ANY Arduino Micro. I have used the UNO R3 for these simple projects.

Change your callsign on Line 12 then hit Compile / Upload

The text (or callsign) on Line 12 will be flashed using the built in LED on Pin 13

CW Callsign Flasher

CW Callsign Flasher – Arduino UNO R3

Size: 1.3 Kb
Published: 29 April 2026

// --- MORSE CODE CALLSIGN BLINKER ---
// Wavewizards.org M9WWA
// This sketch blinks an LED connected to pin 13 (built-in LED on most boards)
// to send your ham radio callsign in Morse code.
// Great for learning: arrays, loops, delays, and timing.

// Define the pin where the LED is connected
const int ledPin = 13;

// Define your callsign as a string (e.g., "M9WWA")
// You can change this to your own callsign!
const char callsign[] = "M8WWA";

// Morse code timing (in milliseconds)
const int dotDuration = 200;      // Short beep = dot
const int dashDuration = 600;     // Long beep = dash
const int spaceDuration = 200;    // Space between dots/dashes in same letter
const int letterSpace = 600;      // Space between letters
const int wordSpace = 1200;       // Space between words (not used here)

// Morse code lookup table for letters A-Z and numbers 0-9
// Each character is stored as a string of dots (.) and dashes (-)
const char* morseCode[] = {
  ".-",   "-...", "-.-.", "-..",  ".",    "..-.", "--.",  "....", "..",   ".---",  // A-J
  "-.-",  ".-..", "--",   "-.",   "---",  ".--.", "--.-", ".-.",  "...",  "-",     // K-T
  "..-",  "...-", ".--",  "-..-", "-.--", "--..", "-----", ".----", "..---", "...--", // U-Z, 0-4
  "....-", ".....", "-....", "--...", "---..", "----."  // 5-9
};

// Helper function: send a single dot
void sendDot() {
  digitalWrite(ledPin, HIGH);   // Turn LED on
  delay(dotDuration);         // Wait for dot duration
  digitalWrite(ledPin, LOW);    // Turn LED off
  delay(spaceDuration);       // Short space after dot
}

// Helper function: send a single dash
void sendDash() {
  digitalWrite(ledPin, HIGH);   // Turn LED on
  delay(dashDuration);        // Wait for dash duration
  digitalWrite(ledPin, LOW);    // Turn LED off
  delay(spaceDuration);       // Short space after dash
}

// Helper function: send a single character in Morse code
void sendMorseChar(char c) {
  if (c >= 'A' && c <= 'Z') {
    // Convert letter to index (A=0, B=1, etc.)
    int index = c - 'A';
    const char* code = morseCode[index];
    // Loop through each symbol in the code
    for (int i = 0; code[i] != '\0'; i++) {
      if (code[i] == '.') {
        sendDot();
      } else if (code[i] == '-') {
        sendDash();
      }
    }
  } else if (c >= '0' && c <= '9') {
    // Convert number to index (0=26, 1=27, etc.)
    int index = c - '0' + 26;
    const char* code = morseCode[index];
    for (int i = 0; code[i] != '\0'; i++) {
      if (code[i] == '.') {
        sendDot();
      } else if (code[i] == '-') {
        sendDash();
      }
    }
  }
  // Add space after each letter
  delay(letterSpace);
}

// Setup function: runs once at startup
void setup() {
  pinMode(ledPin, OUTPUT);  // Set LED pin as output
  Serial.begin(9600);     // Optional: start serial monitor for debugging
  Serial.println("Code Ready!");
}

// Loop function: runs repeatedly
void loop() {
  // Send the entire callsign
  for (int i = 0; callsign[i] != '\0'; i++) {
    char c = callsign[i];
    if (c >= 'a' && c <= 'z') {
      c = c - 'a' + 'A';  // Convert lowercase to uppercase
    }
    sendMorseChar(c);
  }
  // Wait before repeating
  delay(wordSpace);
}

Back to Arduino

Compare Listings

Title