Warning: Undefined array key "HTTP_ACCEPT_LANGUAGE" in /home/pacolabs/www/global_utf8.php on line 932

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /home/pacolabs/www/global_utf8.php on line 932
Morse-It by Pacolabs
Morse-It

MIDI Hardware interface Sample


In Morse-it, it is possible to use a MIDI device as Morse input.
By default,

Here is a cheap and easy way to create such an adapter for your own Morse key.

You'll need : Here is a photo of my configuration:
In this configuration, the Morse key is connected to the ground and to the I/O pins 3 and 4.

I'm using the librairies adafruit_midi (only a subset of it is necessary), adafruit_debouncer, adafruit_ticks.
The following code has been tested with CircuitPython 9.1.1, so you might have to upgrade your circuitpython version (as explained here).


There are 2 specific python files to make this work :
  1. code.py (the main code including a debouncer):
    
    import usb_midi
    import adafruit_midi
    import board
    import digitalio
    
    from adafruit_debouncer import Debouncer
    from adafruit_midi.note_on import NoteOn
    from adafruit_midi.note_off import NoteOff
    
    midi = adafruit_midi.MIDI(midi_out=usb_midi.ports[1], out_channel=0)
    
    # Define the pins
    pin_left = digitalio.DigitalInOut(board.A3)
    pin_left.direction = digitalio.Direction.INPUT
    pin_left.pull = digitalio.Pull.UP
    switch_left = Debouncer(pin_left)
    
    
    pin_right = digitalio.DigitalInOut(board.A4)
    pin_right.direction = digitalio.Direction.INPUT
    pin_right.pull = digitalio.Pull.UP
    switch_right = Debouncer(pin_right)
    
    while True:
        switch_left.update()
        switch_right.update()
    
        if switch_left.fell:
            midi.send(NoteOn(18, 120))
        if switch_left.rose:
            midi.send(NoteOff(18, 120))
        if switch_right.fell:
            midi.send(NoteOn(38, 120))
        if switch_right.rose:
            midi.send(NoteOff(38, 120))
    		

  2. boot.py (the code necessary to disable the keyboard feature):
    
    import usb_hid
    usb_hid.disable()
    		

Click here, to directly download an archive with the needed librairies and those 2 python files.
Unarchive the downloaded file, and put all the unarchived content directly on the disk of your Trinket MO:
(Move/Replace the code.py, boot.py files and lib folder to the root directory of the CIRCUITPI drive).

That's all!
you can now use Morse-it with your external key.