My findings on the 2.8" TouchScreen

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

My findings on the 2.8" TouchScreen

Postby nothinrandom » Tue Jul 05, 2011 11:44 pm

Hello Everyone,

By now, I've had about four weeks to mess around with this touchscreen and I must say that it's quite neat. There is a tutorial that is from adafruit (), however we can save a few things. Follow tutorial and connect all the pins to an Arduino as guided: (D2-D7)[LCD] is connected to (D2-D7)[Arduino] and (D0-D1)[LCD] is connected to (D8-D9)[Arduino]. What we have left are four touchscreen wires, CS, C/D, WR, RD, and RST. Connect RD to Vdd (5V); this saves you one pin. Connect WR to analog0, X- and C/D to analog1, and CS and Y+ to analog2, Y- to D9[Arduino], and X+ to D8[Arduino]. This should leave you with the reset(RST) button left. The problem exists here. If you tie it to the Arduino's reset line, the screen gets all freaked out every time you power it on. Even if you get it to work for a little bit, the data gets all messy when you call up tft.fillscreen(). You're forced to have to hit the reset to properly synch the data. To avoid this, you connect the RST wire to the WR[analog0]. How can we do this? This is because reset() gets called before anything else in the library. Go ahead and tie RST and WR together and you no longer have this unsynched problem at all. Imagine that you have this Arduino sitting inside an enclosure, you don't want to have to hit that reset button every time you power it on.

As for the code:
#define YP A2 //used to be A3
#define XM A1 //used to be A2
#define YM 9
#define XP 8

#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940

// 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);

#define LCD_CS A2 //used to be A3
#define LCD_CD A1 //used to be A2
#define LCD_WR A0 //used to be A1
#define LCD_RD A6 // just change it so that it's outside the range
// optional
#define LCD_RESET A0

As for functions, I fused this great library that I found: http://www.henningkarlsen.com/electroni ... raph16.php into the adafruit tft library. This was before adafruit came out with the tft.print/tft.println function. Now, the only thing that's somewhat useful from the graph16 library is the drawroundrectangle. It's really nice if you want to draw buttons.

I hope this helps people who might encounter the same problem that I faced.
nothinrandom
 
Posts: 31
Joined: Fri May 27, 2011 5:18 pm

Re: My findings on the 2.8" TouchScreen

Postby adafruit » Wed Jul 06, 2011 3:05 pm

great! the only problem with not using RD is that it is very helpful for debugging the wiring

we will be adding triangles, roundrects and buttons shortly to our library - still being debugged :)
User avatar
adafruit
 
Posts: 10483
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc


Return to Other Arduino products from Adafruit

Who is online

Users browsing this forum: No registered users and 2 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [105]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]