Buongiorno,
non riesco più ad utilizzare lo schermo TFT da 1.77 originale Arduino Robot lcd. Prima fino all’anno scorso lo utilizzavo tranquillamente. La cosa si ripete su due schermi diversi e due arduino uno diversi
Ho connesso come sempre lo schermo TFT utilizzando il tutorial di Arduino CC
Ho utilizzato anche un vecchio ide di arduino 1-06, installato tutte le librerie possibili, ma lo schermo rimane bianco. Ho controllato e ricontrollato i pin e sono giusti. Ho Arduino uno che ha sempre funzionato con questo schermo, ho visto che da come “RITIRATI” la parte degli esempi relativi al TFT nell’ultimo IDE di Arduino, di seguito il codice, è presente la parte per convertire i dati di un sensore, ma a mio avvisoè ininfluente, lo schermo resta sempre bianco:
#include <TFT.h> // Arduino LCD library
#include <SPI.h>
// pin definition for the Uno
#define cs 10
#define dc 9
#define rst 8
TFT TFTscreen = TFT(cs, dc, rst);
// char array to print to the screen
char sensorPrintout[4];
void setup() {
// Put this line at the beginning of every sketch that uses the GLCD:
TFTscreen.begin();
// clear the screen with a black background
TFTscreen.background(0, 0, 0);
// write the static text to the screen
// set the font color to white
TFTscreen.stroke(255, 255, 255);
// set the font size
TFTscreen.setTextSize(2);
// write the text to the top left corner of the screen
TFTscreen.text("Sensor Value :\n ", 0, 0);
// ste the font size very large for the loop
TFTscreen.setTextSize(5);
}
void loop() {
// Read the value of the sensor on A0
String sensorVal = String(analogRead(A0));
// convert the reading to a char array
sensorVal.toCharArray(sensorPrintout, 4);
// set the font color
TFTscreen.stroke(255, 255, 255);
// print the sensor value
TFTscreen.text(sensorPrintout, 0, 20);
// wait for a moment
delay(250);
// erase the text you just wrote
TFTscreen.stroke(0, 0, 0);
TFTscreen.text(sensorPrintout, 0, 20);
}