Arduino/Morse Library: Difference between revisions
From charlesreid1
| Line 36: | Line 36: | ||
==Example Sketch== | ==Example Sketch== | ||
There is an example sketch included with the Morse library, given below. It shows how to send morse code in two ways: first, by sending a string. Second, by sending characters representing specific letters. Here is the example: | |||
<source lang="c"> | <source lang="c"> | ||
Revision as of 00:08, 20 July 2015
This is a little more information on the W5OBM Morse library, from the Arduino Ham Radio book.
http://www.w5obm.us/Arduino/index.html
Installing
Download
To install the W5OBM Morse library, download the directory containing the C code for the Morse library (link to the code).
Making a Zip File
Create a zip file from this directory, which will be called Morse.zip
Morse.zip will contain a folder called Morse/
The folder Morse will contain a file called Morse.h
Loading Library in Arduino
Now you can load the library into Arduino using the zip file you've just created.
Open the Arduino Development Environment, and pick Sketch > Include Library > Add .ZIP Library
Navigate to the zip file Morse.zip and pick it. The menu and window should close.
Using the Library in Arduino
When you re-open the Sketch > Include Library menu, you should see the library you added at the very bottom.
Using
Example Sketch
There is an example sketch included with the Morse library, given below. It shows how to send morse code in two ways: first, by sending a string. Second, by sending characters representing specific letters. Here is the example:
// Author Erik Linder
// Released 2011 under GNU GPLv3
//
// Usage: morse( <pin number>, <speed WPM>, <1=beep, 0=PTT> )
// sendmsg( "<text-to-send>" )
//
#include <Morse.h>
// Uncomment to beep a speaker at pin 9
Morse morse(9, 12, 1);
void setup()
{
// Nothing here for the Morse lib
}
void loop()
{
morse.sendmsg("HELLO WORLD!");
delay (2000);
morse.send(83);
morse.send(77);
morse.send(48);
morse.send(82);
morse.send(86);
morse.send(86);
delay (2000);
}