From charlesreid1

No edit summary
No edit summary
Line 1: Line 1:
michael-morse is yet another Python morse code library. Code is on GitHub here: https://github.com/charlesreid1/michael-morse
This page describes how to send code in Python from a Raspberry Pi, using the michael-morse library. Code is on GitHub here: https://github.com/charlesreid1/michael-morse


=Overview=
=Overview=
Line 5: Line 5:
==How It Works==
==How It Works==


This library basically creates a queue of activities.
The michael-morse library basically creates a queue of activities.
It translates an ascii message into morse code, and morse code  
It translates an ascii message into morse code, and morse code  
into a series of scheduled on/off switches.
into a series of scheduled on/off switches.
Line 17: Line 17:
==The Code==
==The Code==


You can find the code on GitHub: https://github.com/charlesreid1/michael-morse
The code is on GitHub: https://github.com/charlesreid1/michael-morse


==Example==
==Example==


There is a simple example included in the GitHub repository: https://github.com/charlesreid1/michael-morse
There is a simple example included in the GitHub repository: https://github.com/charlesreid1/michael-morse The example shows you how to control an LED on the Raspberry Pi GPIO by integrating it with the Morse library.


This example shows you how to control an LED on the Raspberry Pi GPIO by integrating it with the Morse library.
The procedure looks like this:
 
* Prepare the GPIO to be controlled by the Raspberry Pi
Here's what the final product looks like. This is about as simple as it gets, folks: you turn on some GPIO pins, you redefine the on/off functions, you make a Michael Morse, then you fire off your message.
* Define the on/off functions controlled by the morse code keyer
* Make a Michael Morse object
* Fire off your message


<source lang="python">
<source lang="python">
Line 57: Line 59:
</source>
</source>


==Outcome==
=The Who What Why And All That=


==Why michael-morse?==
==Why michael-morse?==

Revision as of 20:30, 31 July 2015

This page describes how to send code in Python from a Raspberry Pi, using the michael-morse library. Code is on GitHub here: https://github.com/charlesreid1/michael-morse

Overview

How It Works

The michael-morse library basically creates a queue of activities. It translates an ascii message into morse code, and morse code into a series of scheduled on/off switches.

These switches are tied to actions that can be either hardware- or software-based.


Details

The Code

The code is on GitHub: https://github.com/charlesreid1/michael-morse

Example

There is a simple example included in the GitHub repository: https://github.com/charlesreid1/michael-morse The example shows you how to control an LED on the Raspberry Pi GPIO by integrating it with the Morse library.

The procedure looks like this:

  • Prepare the GPIO to be controlled by the Raspberry Pi
  • Define the on/off functions controlled by the morse code keyer
  • Make a Michael Morse object
  • Fire off your message
# Use michael-morse to make an LED blink using Raspberry Pi GPIO.

# -----------------------
# RPi stuff
try:
    import RPi.GPIO as GPIO
except RuntimeError:
    print("Error importing RPi.GPIO! This is probably because you need superuser privileges. You can achieve this by using 'sudo' to run your script")
# get ready to use gpio from pi
GPIO.cleanup()
GPIO.setmode(GPIO.BOARD)
# use channel 15, i.e., P22
channel = 16
# gpio is used for output
GPIO.setup(channel, GPIO.OUT)

def LED_on():
    GPIO.output(channel,GPIO.HIGH)
def LED_off():
    GPIO.output(channel,GPIO.LOW)

# -----------------------

from MichaelMorse import MichaelMorse

m = MichaelMorse(15,on=LED_on,off=LED_off)
m.send("hello world de kc7dbu")

Outcome

The Who What Why And All That

Why michael-morse?

What makes it different? This morse code library is aimed at use with the Raspberry Pi, so applications for using morse code include both circuitry (controlling the GPIO pin voltages) and non-circuitry (performing tasks or subroutines). Most of the other libraries I'd found were aimed at one or the other.

Who's michael-morse?

The name of the library is an homage to Michael Morse, outfielder and designated hitter on the 2014 San Francisco Giants World Series team.