Hardware Reference
In-Depth Information
This function is required before using functions such as
drawBMP()
(explained
next) and
playFile()
(explained in the “Music” section). Be aware that this
library is fairly large and should be used only if you require the SD slot; complex
sketches may have unexpected results if the SD card slot is initialized.
To draw a graphics i le to the screen, use
drawBMP()
:
Robot.drawBMP(filename, x, y);
The
filename
parameter is the name of the i le located on the SD card. It must
be in BMP format. The
x
and
y
parameters are the coordinates of the top-left
corner of the image.
Displaying logos is often useful when starting a sketch, but the Arduino Robot
library has a better solution.
displayLogos()
displays two logos on the screen:
Robot.displayLogos();
This function takes no parameters and automatically looks for two i les on the
SD card:
lg0.bmp
and
lg1.bmp
. This function i rst loads
lg0.bmp
and displays
it on the TFT screen before waiting for 2 seconds. Afterward, it loads
lg1.bmp
and again waits for 2 seconds. These i les are present on the SD card by default
but can be replaced.
To clear the screen, use
clearScreen()
:
Robot.clearScreen();
This automatically clears the screen using the default background color (black,
unless specii ed otherwise).
It is possible to write text to the screen, using
text()
:
Robot.text(text, x, y, write);
The
text
parameter can be a
String
but also an
int
or a
long
. The
x
and
y
parameters are the coordinates of the start position. The
write
parameter is a
Boolean
:
true
if the color to use is the foreground color (write) or
false
if the
TFT screen uses the background color (erase).
To display debug information on the TFT screen, use
debugPrint():
Robot.debugPrint(value);
Robot.debugPrint(value, x, y);
The
value
parameter can be either an
int
or a
long
. The
x
and
y
variables are
optional and tell the function where to print the text. By default, the text will
be printed on the top-left corner. This function not only prints a value, but also
refreshes it, adding a unique debugging feature.
Another debug function, and a rather pretty one, is achieved with
drawCompass():
Robot.drawCompass(degrees);
Search WWH ::
Custom Search