Arduino touchscreen projects are simple to get started using the touch shield from Seeeduino. I picked up a shield as part of some kit bought from a friend. The SeeedStudio TFT TouchShield I’m using is a v1 model that has already been deprecated. However, the wiki page has enough info and links to get up and running.
Following the GitHub link to the TouchShield repo, pull down the repo as a .ZIP file.
To install the repo as a library within Arduino, extract the .ZIP file. There should be a directory extracted called “TFT_Touch_Shield_V1-master”. Rename this directory to “TFT_TouchShield”. Copy the renamed directory to your Arduino sketchbook library. The default on Linux is /home/USER/sketchbook/libraries. The default sketchbook library on Windows is My Documents\Arduino\libraries and OSX it’s ~/Documents/Arduino/libraries. It’s important that you renamed the directory. I found that using the directory as its name in the repo will cause compilation errors.
Restart the Arduino IDE for it to detect the new library.
Most of the examples included in the TFT_TouchShield library require a ‘TouchScreen’ library. If you get error messages like:
drawCircle.cpp:16:25: fatal error: TouchScreen.h: No such file or directory
compilation terminated.
You’ll need to install the Touch-Screen-Library from Adafuit available on GitHub. You’ll need to download the ZIP, unpack, rename the directory, and copy it to the library folder. Rename the directory to “TouchScreen”. The next error in the TFT_TouchShield examples is when they use the Point class from TouchScreen. For example, building the paint demo you’ll encounter error messages like:
paint.cpp: In function ‘void loop()’:
paint.cpp:83:5: error: ‘Point’ was not declared in this scope
paint.cpp:83:11: error: expected ‘;’ before ‘p’
paint.cpp:87:5: error: ‘p’ was not declared in this scope
Point changed to TSPoint. If you go to line #83 and change Point to TSPoint you will able to build the demo. Other demos that use the Point class will have to same issue. Just change the Point to TSPoint.