Rev | Line | |
---|
[136] | 1 | /*
|
---|
| 2 | LCD Write Text
|
---|
| 3 |
|
---|
| 4 | Use the Robot's library function text() to
|
---|
| 5 | print out text to the robot's screen. Take
|
---|
| 6 | into account that you need to erase the
|
---|
| 7 | information before continuing writing.
|
---|
| 8 |
|
---|
| 9 | Circuit:
|
---|
| 10 | * Arduino Robot
|
---|
| 11 |
|
---|
| 12 | created 1 May 2013
|
---|
| 13 | by X. Yang
|
---|
| 14 | modified 12 May 2013
|
---|
| 15 | by D. Cuartielles
|
---|
| 16 |
|
---|
| 17 | This example is in the public domain
|
---|
| 18 | */
|
---|
| 19 |
|
---|
| 20 | #include <ArduinoRobot.h>
|
---|
| 21 | #include <Wire.h>
|
---|
| 22 | #include <SPI.h>
|
---|
| 23 |
|
---|
| 24 | void setup() {
|
---|
| 25 | // initialize the robot
|
---|
| 26 | Robot.begin();
|
---|
| 27 |
|
---|
| 28 | // initialize the screen
|
---|
| 29 | Robot.beginTFT();
|
---|
| 30 | }
|
---|
| 31 | void loop() {
|
---|
| 32 | Robot.stroke(0, 0, 0); // choose the color black
|
---|
| 33 | Robot.text("Hello World", 0, 0); // print the text
|
---|
| 34 | delay(2000);
|
---|
| 35 | Robot.stroke(255, 255, 255); // choose the color white
|
---|
| 36 | Robot.text("Hello World", 0, 0); // writing text in the same color as the BG erases the text!
|
---|
| 37 |
|
---|
| 38 | Robot.stroke(0, 0, 0); // choose the color black
|
---|
| 39 | Robot.text("I am a robot", 0, 0); // print the text
|
---|
| 40 | delay(3000);
|
---|
| 41 | Robot.stroke(255, 255, 255); // choose the color black
|
---|
| 42 | Robot.text("I am a robot", 0, 0); // print the text
|
---|
| 43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.