Hello.
I am trying to work with arduino and 3.2 TFT SPI 240x320 V1.0 touchscreen.
Programs work well when i am only wieving objects on screen.
If i want to get to my program work with touch, its impossible, because when i write command ts.InitTouch(); whole display just go to white color and nothing changes in whole program. When i delete this command, touch doesnt work, but showing on display work well. some advices?
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "URTouch.h"
#include <SPI.h>
#define TFT_DC 9
#define TFT_CS 10
#define TFT_RST 8
#define TFT_MISO 12
#define TFT_MOSI 11
#define TFT_CLK 13
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
#define t_SCK 3
#define t_CS 4
#define t_MOSI 5
#define t_MISO 6
#define t_IRQ 7
URTouch ts(t_SCK, t_CS, t_MOSI, t_MISO, t_IRQ);
void setup() {
tft.begin();
tft.setRotation(3);
ts.setPrecision(PREC_MEDIUM);
ts.InitTouch();
tft.fillScreen(ILI9341_BLACK);
}
void loop()
{
int x, y;
while (ts.dataAvailable())
{
ts.read();
x = ts.getX();
y = ts.getY();
if ((x != -1) && (y != -1))
{
Serial.println("p");
x += 13;
y += 4;
int radius = 4;
tft.fillCircle(x, y, radius, ILI9341_YELLOW);
}
}
}