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 #158 background imageLoading...
Page #158 background image
Image data like our thermometer usually doesnt change, so you should always
store it in flash RAM using the
PROGMEM
directive. TVout expects image data
in raw format. The first two bytes contain the width and height of an image.
The data that follows contains the image data line by line. In
thermometer.cpp
,
each line of image data contains three bytes, because the image is 20 pixels
wide, and 20 pixels occupy three bytes. Consequently, the file contains 94
lines each representing a single line of the thermometer image. Because weve
used binary literals to encode the image data, you can actually see how the
image looks when reading the source code. A
1
represents a white pixel, and
a
0
represents a black pixel.
Drawing Images for Your Arduino Programs
You can draw simple images directly in the source code by editing binary
numbers. As soon as your images get more complex, you need some tool
support. For graphics that are still fairly simple but that are too complex to
edit the binary numbers in the source code, you can use any drawing program,
of course, but most modern tools are way too complicated for this job.
Ive created the thermometer image with a fairly simple online tool named
Piskel
.
6
Its open source, its easy to use, and it feels just right for creating
Arduino graphics. You can see it in action in Figure 25, You can find good
online editors for pixel graphics, on page 142.
Applications like
Piskel
really help to create images for your Arduino programs,
but they usually store these images in
.gif
or
.png
files. In the next section,
youll learn how to convert these files into source code.
Turning Pixels into C++ Code
After youve finished your pixel art, you still have to convert it into a C/C++
file. You could do it manually, but that wouldnt be very pragmatic, would it?
Itd be much better to write a small program that does the conversion auto-
matically.
You could write such a program in any modern programming language; well
use Ruby here. Processing graphics in Ruby is easy thanks to the rmagick
library. This library is a binding to ImageMagick,
7
a powerful tool for trans-
forming images. Before you can install rmagick, you have to install
ImageMagick.
6.
http://www.piskelapp.com/
7.
http://www.imagemagick.org/
report erratum discuss
Working with Graphics in TVout 141
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