EasyManuals Logo

Arduino uno User Manual

Arduino uno
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 #82 background imageLoading...
Page #82 background image
Now open a new tab, and when asked for a filename, enter
telegraph.h
. Yes, we
will create a good old C header file. (To be precise, it will even be a C++
header file.)
TelegraphLibrary/telegraph.h
#ifndef __TELEGRAPH_H__
#define __TELEGRAPH_H__
class Telegraph {
public:
Telegraph(const int output_pin, const int dit_length);
void send_message(const char* message);
private:
void dit();
void dah();
void output_code(const char* code);
void output_symbol(const int length);
int _output_pin;
int _dit_length;
int _dah_length;
};
#endif
Ah, obviously object-oriented programming is not only for the big CPUs any-
more! This is an interface description of a
Telegraph
class that you could use
in your next enterprise project (provided that you need to transmit some
information as Morse code, that is).
We start with the classic double-include prevention mechanism; that is, the
body of the header file defines a preprocessor macro named
__TELEGRAPH_H__
.
We wrap the body (that contains this definition) in an
#ifndef
so that the body
is only compiled if the macro has not been defined. That way, you can include
the header as many times as you want, and the body will be compiled only
once.
The interface of the
Telegraph
class consists of a public part that users of the
class have access to and a private part that only members of the class can
use. In the public part, you find two things: a constructor that creates new
Telegraph
objects and a method named
send_message
that sends a message by
emitting it as Morse code. In your applications, you can use the class as fol-
lows:
Telegraph telegraph(13, 200);
telegraph.send_message("Hello, world!");
report erratum discuss
Building a Morse Code Generator 63
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

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

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals