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 #89 background imageLoading...
Page #89 background image
end of the message to be emitted as Morse code. Finally, we set
MAX_MESSAGE_LEN
to the maximum length of the messages we are able to send.
Next we define three global variables:
message_text
is a character buffer that
gets filled with the data we receive on the serial port.
index
keeps track of our
current position in the buffer, and
telegraph
is the
Telegraph
object well use to
convert a message into blinkenlights.
2
setup
initializes the serial port, and in
loop
we check whether new data has
arrived, calling
Serial.available
. We read the next byte if new data is available,
and we check whether it is a newline character or whether it is the last byte
that fits into our character buffer. In both cases, we set the last byte of
mes-
sage_text
to 0, because strings in C/C++ are null-terminated. We also reset
index
so we can read the next message, and finally we send the message using
our telegraph. In all other cases, we add the latest byte to the current message
text and move on.
You should compile and upload the program now. Open the serial monitor
and choose Newline from the line endings drop-down menu at the bottom
of the window. With this option set, the serial monitor will automatically
append a newline character to every line it sends to the Arduino. Enter a
message such as your name, click the Send button, and see how the Arduino
turns it into light. In the following figure, you can see what happens when
you enter my name.
2.
http://en.wikipedia.org/wiki/Blinkenlights
Chapter 4. Building a Morse Code Generator Library 70
report erratum discuss
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