Hello, i want to show a variable on my ILI9341 TFT screen but i need help.
My code:
/**********************************************************************
Interfacing ESP8266 NodeMCU with ILI9341 TFT display (240x320 pixel).
This is a free software with NO WARRANTY.
https://simple-circuit.com/
/**********************************************************************
/**********************************************************************
This is our GFX example for the Adafruit ILI9341 Breakout and Shield
----> http://www.adafruit.com/products/1651
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
**********************************************************************/
#include <Adafruit_GFX.h> // include Adafruit graphics library
#include <Adafruit_ILI9341.h> // include Adafruit ILI9341 TFT library
#define TFT_CS D2 // TFT CS pin is connected to NodeMCU pin D2
#define TFT_RST D3 // TFT RST pin is connected to NodeMCU pin D3
#define TFT_DC D4 // TFT DC pin is connected to NodeMCU pin D4
// initialize ILI9341 TFT library with hardware SPI module
// SCK (CLK) ---> NodeMCU pin D5 (GPIO14)
// MOSI(DIN) ---> NodeMCU pin D7 (GPIO13)
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
void setup() {
Serial.begin(9600);
Serial.println("ILI9341 Test!");
tft.begin();
tft.setRotation(1);
// read diagnostics (optional but can help debug problems)
uint8_t x = tft.readcommand8(ILI9341_RDMODE);
Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDMADCTL);
Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDPIXFMT);
Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDIMGFMT);
Serial.print("Image Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDSELFDIAG);
Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX);
Serial.println(F("Benchmark Time (microseconds)"));
Serial.print(F("Text "));
Serial.println(testText());
Serial.println(F("Done!"));
}
byte runXTimes = 0;
void loop() {
if (runXTimes)
{
testText();
runXTimes--;
}
}
String myvariable = test;
unsigned long testText() {
tft.fillScreen(ILI9341_BLACK);
tft.setCursor(40, 55);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(2);
tft.println("myvariable");
}
And the error i become is:
1time_tft:74:21: error: 'test' was not declared in this scope
String myvariable = test;
^
exit status 1
'test' was not declared in this scope
can someone help me please, i'm new with Arduino.
Thanks!
Regards
Alex