Home Page | Language Reference (extended) | SD Reference | Libraries | Comparison | Changes
A helper function for displaying the compass on the TFT. Relies on Robot.beginTFT(). drawCompass() uses debugPrint(), which can't be used in the same sketch.
Mind where you draw text and other graphic elements when using drawCompass()
so that you don;t overlap elements.
Robot.drawCompass(degrees);
degrees: int between 0 and 359. Typically it's determined by Robot.compassRead().
none
#include <ArduinoRobot.h>
int compassValue;
void
setup
(
)
{
Robot.begin
(
)
;
Robot.beginTFT
(
)
;
//Initialize the TFT module
}
void
loop
(
)
{
compassValue=Robot.compassRead
(
)
;
Robot.drawCompass
(compassValue)
;
//draw the compass
}
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.