Touch screen examples: keypad, paint, image viewer and calculator

Some example sketches for a 2.8 TFT Shield touch screen: A numeric keypad, a basic paint program, an  image viewer and a calculator. The shield comes with an SDcard slot. The image viewer reads images from an sdcard

You mount the shield onto an Arduino Uno (or Leonardo) like this:

These examples have been tested with this screen for sale at (or here at Tinytronics):
TFT: Ilitek-ILI9341 SPI
Touch: 4-wire resistive touchscreen attached to STMPE610 controller, but wired as a breakout-board…

Tested on both an Arduino Uno and a Leonardo.

Download the example sketches:

More examples can be found here.


Viewing an image on the TFT Shield

The example “tftbmp” reads an image from an an SDcard in the SDcard-slot.
I had various results with SDcards: some worked, some did not work. It seems that cards of type “SD2” work, and type “SDHC” not.
Update: SDHC cards can be used if you switch to the SdFat library. The example “tftbmp_sdfat” uses this library.
To test the card, use the sketch sd_test.ino (part of zip-file) or SdInfo from the SdFat library examples (File > Examples > SdFat). It also displays the card type.

If it does not work, make sure the microSD card is formatted in FAT16*.

On your computer, copy the images from Arduino\libraries\Adafruit_TFTLCD\bitmaps to the card. Eject the card and insert it into the slot of the TFT Display module.
Open the example “tftbmp” (from the zip-file).
Start the Serial Monitor (if nessessary, adjust baud rate to 9600) and check the output.
If you get “File not found” errors, check the card*.

* check the card with the sketch sd_test.ino.
If the card is not readable, you might have to format it in FAT16 and add a 4Gb partition.
To format a card in Windows, start a command prompt (click Start, type ‘cmd’), then type (without the comments):

list disk
		   After selecting the disk, use 'list disk'
		   to double-check the proper disk is marked with a *
create partition primary size=4000
format fs=fat   /* this will take some time*/