Figure 14 Find the sketchbook location in the Preferences.
TelegraphLibrary/examples/HelloWorld/HelloWorld.ino
#include "telegraph.h"
const unsigned int
BAUD_RATE
const unsigned int
OUTPUT_PIN = 13;
const unsigned int
DIT_LENGTH = 200;
Telegraph telegraph(OUTPUT_PIN, DIT_LENGTH);
void
setup() {
Serial.begin(BAUD_RATE);
}
void
loop() {
telegraph.send_message("Hello,
delay(5000);
}
This sketch emits the string "Hello, world!" as Morse code every five seconds.
To achieve this, we include the definition of our
constants for the pin our LED is connected to and for the length of our dits.
Then we create a global
we then invoke
send_message
When you compile this sketch, the Arduino IDE automatically compiles the
telegraph library, too. If you forgot to copy the library files to the
folder, you ll get an error message such as "Telegraph does not name a type."
Chapter 4. Building a Morse Code Generator Library
= 9600;
world!");
Telegraph
object and an empty
on our
Telegraph
instance every five seconds.
www.it-ebooks.info
Telegraph
class, and we define
setup
function. In
libraries/Telegraph
68
loop
,
report erratum
discuss
Need help?
Do you have a question about the Arduino Uno and is the answer not in the manual?