I have recently bought Arduino UNO and ITDB02 2.8 Touch Screen. There are 3 sample programs for ITDB02 2.8 Touch Screen Library : Google Code Archive - Long-term storage for Google Code Project Hosting. . I am able to run the first two but the touch screen application does not runs properly. It seems that the touch screen functionality is not working fine.
Also I am not able to see free or better graphics type apps using for ITDB02 2.8 Touch Screen (wrt Arduino UNO board). I am not sure either what type of graphics application we can develop using this hardware combo. Any reference to some graphics app would be helpful and also why the touch screen functionality is not working?
Below is the code - as per the code and app when I move my finger on the TFT the values of X,Y co-ordinates are not changing. BTW these are preliminary graphics - can we use these libs to create a push button with a text in it .
I am not sure what values to use / replace of for ITDB02 lcd(0,1,2,3,4,5,6,7,19,18,17,16); & lcd.Touchpin(15,10,14,9,8) API calls? How do we determine that?
//20140208 art100 tft2.4" st7783 shield on arduino uno
// art100 write message
//#include "st7783SD.h" // pins SD_SS-10 SD_DI-11(in) SD_DO-12(out) SD_SCK-13 no work
//#include "st7783TFT.h" //has not written
//#include "st7783TouchScreen.h" //has not written
#include "TFTLCD.h" // work
#include "TouchScreen.h" // bad but it works
//TouchScreen define
#define YP A1 //tftloop-YU pcbundertft-13 arduinoshieldLCD_WR!!! arduinouno-A1
#define XM A2 //tftloop-XR pcbundertft-14 arduinoshieldLCD_RS!!! arduinouno-A2
#define YM 7 //tftloop-XR pcbundertft-15 arduinoshieldLCD_D7 arduinouno-7
#define XP 6 //tftloop-XR pcbundertft-12 arduinoshieldLCD_D6 arduinouno-6
#define TS_MINX 150//0
#define TS_MINY 120//0
#define TS_MAXX 920//900//320 //for calibrate analog resistans ~1500om/700om
#define TS_MAXY 940//800//900//240 //for calibrate analog resistans ~1500om/700om
// For better pressure precision, we need to know the resistance// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
//TFT define
#define LCD_RESET A4//
#define LCD_CS A3
#define LCD_CD A2 //cmosbuffer-arduinoshieldLCD_RS!!! arduinouno-A2 this is jock :-?
#define LCD_WR A1 //cmosbuffer-arduinoshieldLCD_WR!!! arduinouno-A1 this is jock :-?
#define LCD_RD A0
// Color definitions
#define WHITE 0xFFFF
#define BLACK 0x0000
#define RED 0xF800
#define BLUE 0x001F
#define GREEN 0x07E0
#define YELLOW 0xFFE0
TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
//SD define //has not written
#define bordur 5
#define pen 3
//---------------------------------------
void setup(void) {
Serial.begin(9600);
Serial.println("Paint");
tft.reset();
uint16_t identifier = tft.readRegister(0x0);
tft.initDisplay();
tft.fillScreen(RED);
}
#define MINPRESSURE 10 // analog calibrate
#define MAXPRESSURE 1000 // analog calibrate
//=======================================
void loop(){
Point p = ts.getPoint(); // get analog point
pinMode(XM, OUTPUT); //2 chip on one pins
pinMode(YP, OUTPUT); //2 chip on one pins
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) { // analog calibrate
p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width ()); // aprocsimate variable
p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height()); // aprocsimate variable
// if (300< p.x) { // erase only on bordur //no need have reset button
// Serial.println("erase"); // test
// tft.fillRect(0, 0, tft.width(), tft.height(), RED);// BLACK); //fill black
// }
// test
Serial.print("getPoint x=");Serial.print(p.x);Serial.print(" y=");Serial.print(p.y);Serial.print(" PRESSURE=");Serial.print(p.z);
// paint
if (((p.x)<tft.width()) && ((p.y)<tft.height())) { tft.fillRect(p.x,p.y,pen,pen,GREEN); }
}
}
Sorry I am newbie in Arduino Development and don't understand much about "resistors matric". I have just plugged the ITDB02 2.8 Touch Screen shield to Arduino UNO and as below program is working fine I assume that my insertion is correct:
TFT+touchscreen+arduino - all newcomers :-?
2.good shield has not disintegrated :-0
3.good code is not yet
4.trends have not tested well
What's the problem you?
see my work code
my resistive 700...1700 Om
x and y get 10000 0
need finction map
i get right x and y
i no now rigth or not pins we
i tested pins rigth only on my TFTshield on my chip st7781
I belorus.
I understund on english write?
//20140207 art100 tft2.4" st7783 shield on arduino uno
// art100 write message
//#include "st7783SD.h" // pins SD_SS-10 SD_DI-11(in) SD_DO-12(out) SD_SCK-13 no work
//#include "st7783TFTLCD.h"
//#include "st7783TouchScreen.h"
#include "TFTLCD.h"
#include "TouchScreen.h"
//TouchScreen
#define YP A1 //tftloop-YU pcbundertft-13 arduinoshieldLCD_WR!!! arduinouno-A1
#define XM A2 //tftloop-XR pcbundertft-14 arduinoshieldLCD_RS!!! arduinouno-A2
#define YM 7 //tftloop-XR pcbundertft-15 arduinoshieldLCD_D7 arduinouno-7
#define XP 6 //tftloop-XR pcbundertft-12 arduinoshieldLCD_D6 arduinouno-6
#define TS_MINX 150//0
#define TS_MINY 120//0
#define TS_MAXX 920//900//320 //for calibrate analog resistans ~1500om/700om
#define TS_MAXY 940//800//900//240 //for calibrate analog resistans ~1500om/700om
// For better pressure precision, we need to know the resistance// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
//TFT
#define LCD_RESET A4//
#define LCD_CS A3
#define LCD_CD A2 //cmosbuffer-arduinoshieldLCD_RS!!! arduinouno-A2
#define LCD_WR A1 //cmosbuffer-arduinoshieldLCD_WR!!! arduinouno-A1
#define LCD_RD A0
// Color definitions
#define WHITE 0xFFFF
#define BLACK 0x0000
#define RED 0xF800
#define BLUE 0x001F
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
#define BOXSIZE 50
#define PENRADIUS 3//10
int oldcolor, currentcolor;
void setup(void) {
Serial.begin(9600);
Serial.println("Paint");
// pinMode(XM, OUTPUT);
// pinMode(YP, OUTPUT);
tft.reset();
uint16_t identifier = tft.readRegister(0x0);
tft.initDisplay();
tft.fillScreen(BLACK);
// void drawRect(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint16_t color);
// void fillRect(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint16_t color);
tft.fillRect( 0, 0, BOXSIZE, BOXSIZE, RED); // tft.fillRect( 0, 320-BOXSIZE, BOXSIZE, 320, RED);
tft.fillRect(BOXSIZE , 0, BOXSIZE, BOXSIZE, BLUE); // tft.fillRect(BOXSIZE*1, 320-BOXSIZE, BOXSIZE, 320, BLUE);
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, GREEN); // tft.fillRect(BOXSIZE*2, 320-BOXSIZE, BOXSIZE, 320, GREEN);
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, BLACK); //WHITE); // tft.fillRect(BOXSIZE*3, 320-BOXSIZE, BOXSIZE, 320, WHITE);
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, BLACK); // tft.fillRect(BOXSIZE*4, 320-BOXSIZE, BOXSIZE, 320, BLACK);
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, BLACK); //YELLOW); // tft.fillRect(BOXSIZE*5, 320-BOXSIZE, BOXSIZE, 320, YELLOW);
pinMode(13, OUTPUT);
}
#define MINPRESSURE 10
#define MAXPRESSURE 1000
void loop()
{
// tft.fillCircle( 300,200,10,RED);
digitalWrite(13, HIGH);
Point p = ts.getPoint();
digitalWrite(13, LOW);
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) { // we have some minimum pressure we consider 'valid' // pressure of 0 means no pressing!
// turn from 0->1023 to tft.width
p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width());
p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
if (p.x<BOXSIZE && (BOXSIZE*3)<p.y<BOXSIZE) {// press the bottom of the screen to erase
Serial.println("erase");
tft.fillRect(0, 0, tft.width(), tft.height(), BLACK);
}
Serial.print("getPoint x=");Serial.print(p.x);Serial.print(" y=");Serial.print(p.y);Serial.print(" PRESSURE=");Serial.print(p.z);
// if (p.y < BOXSIZE) {
oldcolor = currentcolor;
//
if (0<p.x<BOXSIZE && 0<p.y<BOXSIZE ) { currentcolor = RED; tft.drawRect( 0, 0, BOXSIZE, BOXSIZE, RED); }
else if (0<p.x<BOXSIZE && BOXSIZE <p.y<BOXSIZE*2) { currentcolor = BLUE; tft.drawRect( 0,BOXSIZE , BOXSIZE, BOXSIZE, BLUE); }
else if (0<p.x<BOXSIZE && BOXSIZE*2<p.y<BOXSIZE*3) { currentcolor = GREEN; tft.drawRect( 0,BOXSIZE*2, BOXSIZE, BOXSIZE, GREEN); }
else if (0<p.x<BOXSIZE && BOXSIZE*3<p.y<BOXSIZE*4) { tft.drawRect( 0,BOXSIZE*3, BOXSIZE, BOXSIZE, BLACK); }
else if (0<p.x<BOXSIZE && BOXSIZE*4<p.y<BOXSIZE*5) { tft.drawRect( 0,BOXSIZE*4, BOXSIZE, BOXSIZE, BLACK); }
Serial.print(" currentcolor=");Serial.println(currentcolor);
// if (oldcolor != currentcolor) {
// if (oldcolor == RED ) tft.fillRect( 0, 0, BOXSIZE, BOXSIZE, WHITE);// RED);
// if (oldcolor == BLUE ) tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, WHITE);// BLUE);
// if (oldcolor == GREEN ) tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, WHITE);// GREEN);
// if (oldcolor == WHITE ) tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, WHITE);//
// if (oldcolor == BLACK ) tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, WHITE);// BLACK);
// if (oldcolor == YELLOW) tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, WHITE);// YELLOW);
// }
//
// }
// if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) { tft.fillCircle(240-p.x, 320-p.y, PENRADIUS, currentcolor); } BRED
// if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) { tft.fillCircle(p.x,p.y,PENRADIUS,currentcolor); }
// if (((p.x+PENRADIUS)<tft.width()) && ((p.y+PENRADIUS)<tft.height())) { tft.fillCircle( p.x,p.y,PENRADIUS,currentcolor ); }
// if (((p.x+PENRADIUS)<tft.width()) && ((p.y+PENRADIUS)<tft.height())) {tft.fillRect(10, 10, 10, 10, RED);}
// if ( ((p.x)<tft.width() ) && ( (p.y) < tft.height() ) ) { tft.fillRect(p.x,p.y,10,10,RED); }
if (((p.x)<tft.width()) && ((p.y)<tft.height())) { tft.fillRect(p.x,p.y,PENRADIUS,PENRADIUS,RED); }
}
}
TouchScreen.h and cpp and tftpaint20140308173000ok.pde
my problem this is blink on paint
I no understand you problem whith touch?
see video