Seeedstudio v1.0 TFT touch

so i bought this shield and i can not get it to work i get errors. i have tried serveral libraries all claiming to be for this shield and when i load the examples i get errors like the following:

Arduino: 1.5.4 (Windows 7), Board: "Arduino Uno"

text4Directions.ino: In function 'void setup()':
text4Directions:39: error: 'Tft' was not declared in this scope
text4Directions:40: error: 'LEFT2RIGHT' was not declared in this scope
text4Directions:41: error: 'WHITE' was not declared in this scope
text4Directions:42: error: 'RIGHT2LEFT' was not declared in this scope
text4Directions:44: error: 'DOWN2UP' was not declared in this scope
text4Directions:46: error: 'UP2DOWN' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

OR :

Arduino: 1.5.4 (Windows 7), Board: "Arduino Uno"

touchscreendemo:23: error: 'TouchScreen' does not name a type
touchscreendemo.pde: In function 'void setup()':
touchscreendemo:27: error: 'Tft' was not declared in this scope
touchscreendemo:29: error: 'GREEN' was not declared in this scope
touchscreendemo:30: error: 'BLUE' was not declared in this scope
touchscreendemo:31: error: 'RED' was not declared in this scope
touchscreendemo:32: error: 'CYAN' was not declared in this scope
touchscreendemo:33: error: 'YELLOW' was not declared in this scope
touchscreendemo:34: error: 'WHITE' was not declared in this scope
touchscreendemo.pde: In function 'void loop()':
touchscreendemo:39: error: 'Point' was not declared in this scope
touchscreendemo:39: error: expected `;' before 'p'
touchscreendemo:41: error: 'p' was not declared in this scope
touchscreendemo:41: error: 'ts' was not declared in this scope
touchscreendemo:48: error: 'p' was not declared in this scope
touchscreendemo:53: error: 'ts' was not declared in this scope
touchscreendemo.pde: In function 'void initTouchScreenParameters()':
touchscreendemo:66: error: 'Tft' was not declared in this scope
touchscreendemo:71: error: 'ts' was not declared in this scope
touchscreendemo:71: error: 'TouchScreen' was not declared in this scope
touchscreendemo:89: error: 'ts' was not declared in this scope
touchscreendemo:89: error: 'TouchScreen' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

OR

Arduino: 1.5.4 (Windows 7), Board: "Arduino Uno"

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=154 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard C:\Users\HaXXoR\AppData\Local\Temp\build618463277631155490.tmp\paint.cpp -o C:\Users\HaXXoR\AppData\Local\Temp\build618463277631155490.tmp\paint.cpp.o

paint:25: error: 'TouchScreen' does not name a type
paint:27: error: 'WHITE' was not declared in this scope
paint.pde: In function 'void setup()':
paint:31: error: 'Tft' was not declared in this scope
paint:37: error: 'BLACK' was not declared in this scope
paint:38: error: 'RED' was not declared in this scope
paint:39: error: 'GREEN' was not declared in this scope
paint:40: error: 'BLUE' was not declared in this scope
paint:41: error: 'CYAN' was not declared in this scope
paint:42: error: 'YELLOW' was not declared in this scope
paint:43: error: 'WHITE' was not declared in this scope
paint:44: error: 'GRAY1' was not declared in this scope
paint.pde: In function 'void loop()':
paint:54: error: 'Point' was not declared in this scope
paint:54: error: expected `;' before 'p'
paint:59: error: 'p' was not declared in this scope
paint:59: error: 'ts' was not declared in this scope
paint:72: error: 'BLACK' was not declared in this scope
paint:76: error: 'RED' was not declared in this scope
paint:80: error: 'GREEN' was not declared in this scope
paint:84: error: 'BLUE' was not declared in this scope
paint:88: error: 'CYAN' was not declared in this scope
paint:92: error: 'YELLOW' was not declared in this scope
paint:96: error: 'WHITE' was not declared in this scope
paint:100: error: 'GRAY1' was not declared in this scope
paint:105: error: 'Tft' was not declared in this scope
paint.pde: In function 'void initTouchScreenParameters()':
paint:116: error: 'Tft' was not declared in this scope
paint:121: error: 'ts' was not declared in this scope
paint:121: error: 'TouchScreen' was not declared in this scope
paint:139: error: 'ts' was not declared in this scope
paint:139: error: 'TouchScreen' was not declared in this scope

SOMEONE PLEASE HELP. i am beating my head against the wall trying to get this working and im voming up with nothing

Please post either your code or a link to the example code you are using so that we can help you.

In the meantime, it looks like you haven't put the libraries in the correct place. They must be put in your arduino/libraries folder or they will not be found.

Three sets of error messages each without an explanation of which library was involved isn't
greatly useful - its also confusing to set three bug hunts going at once.

Pick one example and provide a link to the exact version of the library you are using, the exact
sketch you have and the exact and complete error messages for that combination.

The art of reporting problems is to give explicit details as to how to recreate the problem
from scratch - where possible. In particular where did you install the library - there is a
libraries folder where they should go which is documented. The errors tend to suggest
none of the libraries are in the right place, but since you haven't showed us the code or
the library, there's no way of knowing...

well i still dont know what the issue was i rebooted into my windows 8 partition and all is well go figure

Hi mikel0829,

well i still dont know what the issue was i rebooted into my windows 8 partition and all is well go figure

I, too, have the same shield, the one from Seeedstudio (red TFT shield touch) and stumbled upon your thread during a Google search. The library can be found at GitHub - Seeed-Studio/TFT_Touch_Shield_V1: Seeed Tft Touch Shield V1.0

The example code on Seeed’s Wiki http://www.seeedstudio.com/wiki/2.8’’_TFT_Touch_Shield_V1.0 , interestingly enough, is wrong, Point needs to be changed to TSPoint (see adafruit’s example) here https://github.com/adafruit/Touch-Screen-Library/blob/master/examples/touchscreendemoshield/touchscreendemoshield.ino the example on (Seeedstudio’s git) where the recommended library is located, also needs an update. Point should be TSPoint. Anyway, after looking at the code in the example provided, which can be found here TFT_Touch_Shield_V1/touchscreendemo.ino at master · Seeed-Studio/TFT_Touch_Shield_V1 · GitHub and http://www.seeedstudio.com/wiki/2.8’’_TFT_Touch_Shield_V1.0

// a point object holds x y and z coordinates.
    Point p = ts.getPoint();

should be

// a point object holds x y and z coordinates.
TSPoint p = ts.getPoint();

Don’t forget to add Tft.init() in setup() see

https://github.com/adafruit/Touch-Screen-Library/blob/master/examples/touchscreendemoshield/touchscreendemoshield.ino

For anyone else having problems running the example code touchscreendemoshield.ino with the Seeedstudio TFT touch try the code below and good luck :slight_smile:

//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#include <stdint.h>
#include <TouchScreen.h> 
#include <TFT.h>
#ifdef SEEEDUINO
  #define YP A2   // must be an analog pin, use "An" notation!
  #define XM A1   // must be an analog pin, use "An" notation!
  #define YM 14   // can be a digital pin, this is A0
  #define XP 17   // can be a digital pin, this is A3 
#endif

#ifdef MEGA
  #define YP A2   // must be an analog pin, use "An" notation!
  #define XM A1   // must be an analog pin, use "An" notation!
  #define YM 54   // can be a digital pin, this is A0
  #define XP 57   // can be a digital pin, this is A3 
#endif 

//Measured ADC values for (0,0) and (210-1,320-1)
//TS_MINX corresponds to ADC value when X = 0
//TS_MINY corresponds to ADC value when Y = 0
//TS_MAXX corresponds to ADC value when X = 240 -1
//TS_MAXY corresponds to ADC value when Y = 320 -1

#define TS_MINX 140
#define TS_MAXX 900

#define TS_MINY 120
#define TS_MAXY 940


// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

void setup(void) {
  Tft.init();
  Serial.begin(9600);
}

void loop(void) {
  // a point object holds x y and z coordinates
  TSPoint p = ts.getPoint();

  if (p.z > ts.pressureThreshhold) {
     Serial.print("Raw X = "); Serial.print(p.x);
     Serial.print("\tRaw Y = "); Serial.print(p.y);
     Serial.print("\tPressure = "); Serial.println(p.z);
  }
  
 
  p.x = map(p.x, TS_MINX, TS_MAXX, 240, 0);
  p.y = map(p.y, TS_MINY, TS_MAXY, 320, 0);
  
  // we have some minimum pressure we consider 'valid'
  // pressure of 0 means no pressing!
  if (p.z > ts.pressureThreshhold) {
     Serial.print("X = "); Serial.print(p.x);
     Serial.print("\tY = "); Serial.print(p.y);
     Serial.print("\tPressure = "); Serial.println(p.z);
  }

  delay(100);
}

and this

// Paint application - Demonstate both TFT and Touch Screen
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>
 
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) // mega
#define YP A2   // must be an analog pin, use "An" notation!
#define XM A1   // must be an analog pin, use "An" notation!
#define YM 54   // can be a digital pin, this is A0
#define XP 57   // can be a digital pin, this is A3 
 
#elif defined(__AVR_ATmega32U4__) // leonardo
#define YP A2   // must be an analog pin, use "An" notation!
#define XM A1   // must be an analog pin, use "An" notation!
#define YM 18   // can be a digital pin, this is A0
#define XP 21   // can be a digital pin, this is A3 
 
#else //168, 328, something else
#define YP A2   // must be an analog pin, use "An" notation!
#define XM A1   // must be an analog pin, use "An" notation!
#define YM 14   // can be a digital pin, this is A0
#define XP 17   // can be a digital pin, this is A3 
 
#endif
 
//Measured ADC values for (0,0) and (210-1,320-1)
//TS_MINX corresponds to ADC value when X = 0
//TS_MINY corresponds to ADC value when Y = 0
//TS_MAXX corresponds to ADC value when X = 240 -1
//TS_MAXY corresponds to ADC value when Y = 320 -1
 
#define TS_MINX 140
#define TS_MAXX 900
#define TS_MINY 120
#define TS_MAXY 940
 
int color = WHITE;  //Paint brush color
 
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate
 
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300); //init TouchScreen port pins
 
void setup()
{
 
    Tft.init();  //init TFT library
    pinMode(0,OUTPUT);
    //Draw the pallet
    Tft.fillRectangle(0,0,30,10,BLACK);
    Tft.fillRectangle(30,0,30,10,RED);
    Tft.fillRectangle(60,0,30,10,GREEN);
    Tft.fillRectangle(90,0,30,10,BLUE);
    Tft.fillRectangle(120,0,30,10,CYAN);
    Tft.fillRectangle(150,0,30,10,YELLOW);
    Tft.fillRectangle(180,0,30,10,WHITE);
    Tft.fillRectangle(210,0,30,10,GRAY1);
 
}
 
void loop()
{
 
    // a point object holds x y and z coordinates.
    TSPoint p = ts.getPoint();
 
    //map the ADC value read to into pixel co-ordinates
 
    p.x = map(p.x, TS_MINX, TS_MAXX, 240, 0);
    p.y = map(p.y, TS_MINY, TS_MAXY, 320, 0);
 
    // we have some minimum pressure we consider 'valid'
    // pressure of 0 means no pressing!
 
    if (p.z > ts.pressureThreshhold) {
 
 
        // Detect  paint brush color change
        if(p.y < 15)
        {
            if(p.x >= 0 && p.x < 30)
            {
                color = BLACK;
            }
            if(p.x >= 30 && p.x < 60)
            {
                color = RED;
                digitalWrite(0,HIGH);
            }
            if(p.x >= 60 && p.x < 90)
            {
                color = GREEN;
            }
            if(p.x >= 90 && p.x < 110)
            {
                color = BLUE;
                digitalWrite(0,LOW);
            }
            if(p.x >= 120 && p.x < 150)
            {
                color = CYAN;
            }
            if(p.x >= 150 && p.x < 180)
            {
                color = YELLOW;
            }
            if(p.x >= 180 && p.x < 210)
            {
                color = WHITE;
            }
            if(p.x >= 210 && p.x < 240)
            {
                color = GRAY1;
            }
        }
        else
        {
            Tft.fillCircle(p.x,p.y,2,color);
        }
    }
}

Good times.

I created an account just to thank you, dillonberesford, for your post. I was suspecting there was something wrong with the example code but with this being the first Arduino of my own to hack at in my own environment... I wasn't 100% sure that I wasn't doing something incorrectly (e.g.. wrong libs, etc.) so you saved me a lot of time. :slight_smile:

Thanks!

I have several questions regarding this screen and a few other things. I compiled both codes that Dillon posted and I’m still getting errors. The first code shows the fewest errors so I’m working with it.

#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>
#ifdef SEEEDUINO
#define YP A2 // must be an analog pin, use “An” notation!
#define XM A1 // must be an analog pin, use “An” notation!
#define YM 14 // can be a digital pin, this is A0
#define XP 17 // can be a digital pin, this is A3
#endif

#ifdef MEGA
#define YP A2 // must be an analog pin, use “An” notation!
#define XM A1 // must be an analog pin, use “An” notation!
#define YM 54 // can be a digital pin, this is A0
#define XP 57 // can be a digital pin, this is A3
#endif

//Measured ADC values for (0,0) and (210-1,320-1)
//TS_MINX corresponds to ADC value when X = 0
//TS_MINY corresponds to ADC value when Y = 0
//TS_MAXX corresponds to ADC value when X = 240 -1
//TS_MAXY corresponds to ADC value when Y = 320 -1

#define TS_MINX 140
#define TS_MAXX 900

#define TS_MINY 120
#define TS_MAXY 940

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// The 2.8" TFT Touch shield has 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

void setup(void) {
Tft.init();
Serial.begin(9600);
}

void loop(void) {
// a point object holds x y and z coordinates
TSPoint p = ts.getPoint();

if (p.z > ts.pressureThreshhold) {
Serial.print("Raw X = “); Serial.print(p.x);
Serial.print(”\tRaw Y = “); Serial.print(p.y);
Serial.print(”\tPressure = "); Serial.println(p.z);
}

p.x = map(p.x, TS_MINX, TS_MAXX, 240, 0);
p.y = map(p.y, TS_MINY, TS_MAXY, 320, 0);

// we have some minimum pressure we consider ‘valid’
// pressure of 0 means no pressing!
if (p.z > ts.pressureThreshhold) {
Serial.print("X = “); Serial.print(p.x);
Serial.print(”\tY = “); Serial.print(p.y);
Serial.print(”\tPressure = "); Serial.println(p.z);
}

delay(100);
}

When I run this i get

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: “Arduino Uno”
sketch_oct24a:34: error: ‘XP’ was not declared in this scope
sketch_oct24a:34: error: ‘YP’ was not declared in this scope
sketch_oct24a:34: error: ‘XM’ was not declared in this scope
sketch_oct24a:34: error: ‘YM’ was not declared in this scope
sketch_oct24a.ino: In function ‘void setup()’:
sketch_oct24a:37: error: ‘Tft’ was not declared in this scope

In the ide, " TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);" is completely yellow meaning theres something wrong there, but what. Am I supposed to take out the xp yp and add numbers there for the resistance ? Another thing, is this code made to run with the touch screen plugged directly into the uno 3 board or am I supposed to breadboard this with more electronics? This is one problem I have noticed with code on here. People post code but do not tell how it’s implemented in their comments.

Also. I’m using a 32" tv for a monitor. Is there any way to raise the font in the ide? Seeing that small writing on a tv is about impossible.

Eh. Guess I'll stick with microchip.