Skip to content

Python Guide

Chris Vig edited this page Sep 6, 2025 · 5 revisions

This page documents the Python scripts found in the scripts directory. These scripts are the primary way of configuring and interacting with the SuperKey hardware. A standalone library (superkey) is provided, which acts as a wrapper for SuperKey's serial interface. The scripts directory also contains several handy standalone scripts:

  • autokey.py allows controlling the keyer directly with your keyboard.
  • example.py shows a demonstration of using the superkey library, as well as demonstrating some of SuperKey's hardware features.
  • interactive.py creates an "interactive" environment for interfacing with SuperKey with a console-like REPL experience.

The superkey library and the standalone scripts have no dependencies other than the built-in Python standard library. A future improvement is to improve the packaging for this library, to make it more consumable by other Python projects.

AutoKeyer

The autokey.py script provides a convenient interface for using the keyer's autokey mode. The following command line arguments are supported:

  • --port - Serial port name.
  • --baudrate - Serial port baud rate. (This should always be 19200.)
  • --timeout - Serial port timeout, in seconds.
  • --immediate - Activate "immediate" mode.
  • --silent - If specified, input will not be echoed back to the console (only applicable to immediate mode).

There are two modes of operation, as discussed below.

Normal / Buffered Mode

Immediate Mode

Immediate mode is activated by invoking the script with theThe autokey.py script accepts user input from the keyboard, and immediately forwards it on to the keyer to be keyed. Any key press which is not a valid Morse code character is ignored. The following special key presses are supported:

  • Backspace - Immediately stops keying any string which was previously entered. This can be used to "cancel" input.
  • Escape - Exits the tool.

The following notes should be observed in immediate mode:

  • Characters are queued for transmission as they are typed.
  • Newlines may be typed to help separate messages, but are ignored by the keyer.
  • Prosigns may be entered by preceding the characters with a backslash.
    • (e.g., entering \ar will result in the prosign · — · — · being keyed).
  • Prosigns with between 2 and 9 characters are supported by immediately following the backslash with a digit.
    • (e.g., entering \3sos will result in the prosign · · · — — — · · · being keyed).

Clone this wiki locally