Return to the Sintran homepage Return to your previous page

Reload this page1.6 - Norsk Data projects


Morse library

The project

  • Arduino library to generate Morse code.
  • Generate morse code on a digital output pin.
  • Convert text to a morse code string with dots and dashes.
  • Create your own morse code with the dot() and dash() functions.
  • Use standard Print methods like print() and println() to generate morse code on the defined digital output pin.
  • Based on the ITU-R M.1677-1.
  • Generates morse code for all the single characters listed in chapter 1.1.1, 1.1.2 and 1.1.3 (except for the accented e).
  • Undefined/unknown or not printable characters will just be ignored.
  • Download the zip file and read here for: How to install the Morse library.

Hardware

  • None hardware to be assembled.

Software

  • List of files:
    • keywords.txt - Keywords from the morse library to be highlighted in the Arduino IDE.
    • library.properties - Properties for the Morse library.
    • Morse.cpp - The Morse library itself.
    • Morse.h - The header file to be included in your source sketch.
    • README.txt - License information.
    • examples/DOT/DOT.ino - Example sketch using the dot() and dash() to create the morse code for "SOS".
    • examples/SOS/SOS.ino - Example sketch using print to send morse code.
    • examples/STR/STR.ino - Example sketch to create a text string with morse code.
  • Constant definitions:
    • M_DEBUG - For debugging only, not described here
    • M_VERSION_MAJOR
      M_VERSION_MINOR
      M_VERSION_PATCH
      M_VERSION_BUILD
      M_VERSION_DATE
      M_VERSION_NDNO - Morse library version information
    • M_DEFAULT_DURATION - Default length of the morse dot, in ms
    • M_DEFAULT_FREQUENCY - Default tone frequency, in Hz
    • M_DEFAULT_PIN - Default digital output pin to be used (undefined)
    • M_DURATION_DOT
      M_DURATION_DASH
      M_DURATION_SIGNAL
      M_DURATION_LETTER
      M_DURATION_WORD - Multipliers for all the other morse signal durations
  • Type definitions:
    • morseElement - Morse element, not described here
    • Morse - The Morse class to be used in your sketch.
  • Public methodes:
    • Morse(duration, frequency) - Constructor.
      Create a morse object, dot duration and frequency can be given if the default values are not wanted.
    • ~Morse() - Destructor.
    • begin(pin) - Initialize the morse object using this digital output pin.
    • begin(pin, duration) - Initialize the morse object using this digital output pin and duration.
    • begin(pin, duration, frequency) - Initialize the morse object using this digital output pin, duration and frequency.
    • dash() - Create a morse dash signal.
    • dot() - Create a morse dot signal.
    • getDuration()
      getFrequency()
      getPin() - Get the current settings of the duration, frequency and digital output pin.
    • string(str, max, txt) - Create a string with dots and dashes for the given input text.
      str - The string buffer where the morse code dots and dashes are returned. The function also returns a pointer to this string as a function return value.
      max - The maximum length of the str buffer. The conversation stops when the buffer is filled.
      txt - The actual text that shall be converted to morse code.
    • wait(type) - Generates a pause with the correct duration for the given wait type.
    • write(ch) - Internal low level function, not to be called.
      Use standard Print methods like print() and println() to generate morse code on the defined digital output pin.
  • Private variables and methods:
    • morseTable - Table with all the morse codes.
    • _pin
      _duration
      _frequency - Keeps the current settings.
    • findStartOfMorseCode(code) - Finds the start of the given morse code.
    • getMorseCode(ch) - Finds the morse code for the given character.
    • trace(...) - Internal trace function.

Download

ND noProductLanguageReleaseTitleDownloadFilesSizeOriginalType
292012.A00ArduinoENOct. 2016Morse---YesSW
292012.A01ArduinoENJan. 2019MorseZIP file87.9 KBYesSW

Version history

  • Hardware
    • None
  • Software
    • A00 - 2016.10.22 - Original version (internal version)
    • A01 - 2019.01.01 - Rewritten to comply with coding standard, first released version

FAQ

  • None.
  • None.
International Morse Code

This page was last updated 06. Nov. 2023
Copyright © Sintran Data
../valid HTML code ../valid CSS code
Mail us