You are on page 1of 6


8 TFT LCD shield for Arduino Mega

2.4 TFT LCD with touchscreen, for Arduino


2.8 TFT LCD with touchscreen, for Arduino ega

The 2.4 and 2.8" TFT color LCD shields with touch screen interface are the latest addition to our Arduino shields family. Its lar e !"2#$24#% screen resolution& '() color s*ace and touchscreen interface are ideal for de+elo*in nice user interface de+ice. V1.0 28/07//2010

Features 2.4 , 2.8 inch TFT LCD with ILI-"2( controller . "2#$24# resolution and '() color Touch.screen /anel and on.0oard AD184" com*ati0le controller 2D card interface in 2/I mode& for e$ternal mass stora e of *hotos and icons. Directly *lu into Arduino 3e a 0oards Arduino li0rary and e$ma*les of ra*hic and font routines& touch. screen interface and cali0ration& and FAT filesystem on 2D card.

Physical Dimension 78.5mm


(320,240) 2.8 TFT (320, 240) 2.4 TFT


(0,0) 2.4 TFT

(0,0) 2.8 TFT

The ra*h a0o+e shows the *hysical dimension of the 2.8 and 2.4 V1.0 28/07//2010

TFT LCD shield. It also shows the start *oint and end *oint of the LCD at its default hori4ontal orientation.

TFT_lib library for Arduino MegaThe TFT5li0 li0rary can 0e download and used on Arduino *latform. It includes se+eral classes for different tas6s . LCD class in TFT!"L"#$2%.c&&& defines ILI-"2( controller re ister settin & and hardware related 0asic ra*hic functions. 'ra&hics class in TFT!'ra&hics.c&&& is 0aased on LCD class and defines hi h.le+el ad+anced ra*hic functions. TFT!Font class in TFT!Font.c&&& is 0ased on LCD class and defines font drawin functions. It can handle fi$ed and +aria0le width fonts in either uncom*ressed or com*ressed format. 7ser can enerate or im*ort 8indows font 0y usin 9. :eddmann;s Font editor *ro ram. Touch&anel class in touch&anel.c&&& defines functions that initiali4e and read Touchscreen *oints. TFT!(FF class in TFT!(FF.c&&, is a wra* class for the /etit FatFs. The /etit FatFs im*lements a FAT filesystem for em0edded system with +ery limited Flash and :A3 s*aces.

Key user functions in TFT-lib The followin list shows 6ey user functions in the TFT.li0 .. 'ra&hics class ))
// set cursor to *, + +oid 2etCursor!uint<'5t $& uint<'5t y%= // clear screen with color +oid Clear2creen!uint<'5t color > 89IT?%=

V1.0 28/07//2010

// fast draw a solid rectangle with color +oid Fast2olid:ect!uint<'5t $<& uint<'5t y<& uint<'5t $2& uint<'5t y2& uint<'5t color%= // Draw a line fro *,,+, to *2,+2 with color- *,.*2, +,.+2 /*,+0 with color, fill12 3 draw // +oid DrawLine!uint<'5t $<& uint<'5t y<& uint<'5t $2& uint<'5t y2& uint<'5t color%= // Draw a rectangle of /width, height0 fro outline, fill 1 , 3 solid draw

+oid Draw:ect!uint<'5t $& uint<'5t y& uint<'5t width& uint<'5t hei ht& uint<'5t color& uint85t fill%= // Draw a round)rectangle fro /*,,+,0 to /*2,+20 with round edge s&ecified // 4+ radius and color, fill12 3 draw outline, fill 1 , 3 solid draw +oid Draw:ound:ect!uint<'5t $& uint<'5t y& uint<'5t $2& uint<'5t y2& uint<'5t radius& uint<'5t color& uint85t fill%=

// draw a &i*el at /*,+0 with color +oid Draw/i$el!uint<'5t $& uint<'5t y& uint<'5t color%= //Draw a circle at center /*,+0 with radius and color, fill12 3 draw outline, //fill1, solid draw +oid DrawCircle!uint<'5t $& uint<'5t y& uint<'5t radius& uint<'5t color& uint85t fill%= // hardware 5ertical scroll +oid @ertical2croll!int<'5t y%=

TFT!Font class A
// set font color with fColor /font color0, 4Color) 4ac6ground color, //Trans&arent 12, draw 4ac6ground color- Trans&arent1, 3 don7t draw //4ac6ground color +oid set5Color!uint<'5t fColor& uint<'5t 0Color& uint85t Trans*arent%= // set cursor to *, + +oid set5Cursor!uint<'5t $& uint<'5t y%= // select font, su&&ort fi*ed/5aria4le font, co +oid set5Font!uint85t B*5font%= // &rint a character at current cursor &osition +oid *utChar!char c%= // calculate char width uint85t Char8idth!char c%= //&rint 89M string at current cursor &osition +oid *utstr5/!char Bstr%= // calculate 89M string width &ressed or unco &ressed.

V1.0 28/07//2010

uint<'5t str58idth5/!char Bstr%= // (rint 8AM string at current cursor &osition +oid *utstr!char Bstr%= // calculate 8AM string width uint<'5t str58idth!char Bstr%= // (rint integer 5alue +oid *utnum0er!lon n%=

Touch&anel functions ..
// read cali4ration +oid et5matri$!+oid%= // sa5e cali4ration atri* to Arduino ::(89M touch&anel controller +oid sa+e5matri$!+oid%= // read raw touch&anel &oints fro /CIDTB read5t*5*oint!+oid%= // get cali4rated lcd &oints /CIDTB read5lcd5*oint!+oid%= atri* fro Arduino ::(89M

V1.0 28/07//2010


V1.0 28/07//2010