J'arrive a televerser ce programme :
#include <TFT_eSPI.h> // https://github.com/Bodmer/TFT_eSPI
TFT_eSPI tft = TFT_eSPI(); // display object
bool touched() { // true if user touched screen
const int threshold = 500; //500 // ignore light touches
return tft.getTouchRawZ() > threshold;
}
void markLocation(int x, int y) {
tft.fillRect(200,0,120,20,TFT_BLACK); // erase previous coordinates
tft.setCursor(200,0); // at screen top,right:
tft.print(x); tft.print(", "); // show the x coordinate
tft.print(y); // and the y coordinate
tft.fillCircle(x,y,6,TFT_YELLOW); // and place a small circle there
}
void checkForTouch() {
short unsigned int x, y;
if (touched()) { // did user touch the display?
tft.getTouch(&x,&y); // get touch coordinates
if ((x<400)&&(y<400)) { // if coordinates are valid,
markLocation(x,y); // show it on the screen
delay(300); // and wait (touch deboucer)
}
}
}
// ============ MAIN PROGRAM ===================================================
void setup() {
tft.init();
tft.setRotation(1); // portrait screen orientation
tft.fillScreen(TFT_BLACK); // clear the screen
tft.setTextFont(4); // use font 4 (larger text)
tft.setCursor(0,0); // at screen top-left,
tft.print("Touch Test"); // display the title
}
void loop() {
checkForTouch(); // test the touch function!
}
Je n'arrive pas à faire les bon branchement ou bien le fichier user setup de la librairie TFT_eSPI n'est pas parametrer correctement...
Le programme affiche mais ne reconnais pas le tactile.
Solution ???