EasyManuals Logo

Arduino Pro Mini User Manual

Arduino Pro Mini
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #87 background imageLoading...
Page #87 background image
Figure 14Find the sketchbook location in the Preferences.
TelegraphLibrary/examples/HelloWorld/HelloWorld.ino
#include "telegraph.h"
const unsigned int BAUD_RATE = 9600;
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, world!");
delay(5000);
}
This sketch emits the string Hello, world! as Morse code every five seconds.
To achieve this, we include the definition of our
Telegraph
class, and we define
constants for the pin our LED is connected to and for the length of our dits.
Then we create a global
Telegraph
object and an empty
setup
function. In
loop
,
we then invoke
send_message
on our
Telegraph
instance every five seconds.
When you compile this sketch, the Arduino IDE automatically compiles the
telegraph library, too. If you forgot to copy the library files to the
libraries/Telegraph
folder, youll get an error message such as Telegraph does not name a type.
Chapter 4. Building a Morse Code Generator Library 68
report erratum discuss
www.it-ebooks.info

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino Pro Mini and is the answer not in the manual?

Arduino Pro Mini Specifications

General IconGeneral
BrandArduino
ModelPro Mini
CategoryMotherboard
LanguageEnglish

Related product manuals