Reference   Language | Libraries | Comparison | Changes

Robot

text()

Description

Write some text to an attached TFT.

When updating the screen, remember to erase the text before writing new text on the same place, or the new/old text will be overlapping each other.

The screen is only 128 pixels tall and 160 pixels wide. It's recommended to use small values for x and y, or text may be cropped/invisible in unpredictable ways.

Syntax

Robot.text(toWrite, x, y, writeOrErase)

Parameters

toWrite: text/value to be written on the LCD. Can be a string, an int or a long.

x: x axis of starting position on the screen.

y: y axis of starting position on the screen.

writeOrErase: specify whether to write the text or erase the text. Use true to write and false to erase.

Returns

none

Examples

#include <ArduinoRobot.h>

void setup(){
  Robot.begin();
  Robot.beginTFT();//Initialize the TFT module
}

void loop(){
  Robot.text("Hello World",0,0,true);
  delay(2000);

  Robot.text("Hello World",0,0,false);//It's necessary to erase the old text, for showing new text
  Robot.text("I am a robot",0,0,true);
  delay(3000);

  Robot.text("I am a robot",0,0,false);
}

See also

Reference Home

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.

Share