Arduino/Morse Library: Difference between revisions
From charlesreid1
No edit summary |
|||
| Line 36: | Line 36: | ||
==Example Sketch== | ==Example Sketch== | ||
<source lang="c"> | |||
// 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); | |||
} | |||
</source> | |||
Revision as of 23:34, 19 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
// 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);
}