Arduino Arduino ile Dokunmatik TFT Ekran Kullanımı:Ekrana Yazı Yazdırma By Muhammet Özcan Posted on 16 Aralık 2015 10 min read 14 1 25,810 Paylaş ! Facebook Paylaş ! Twitter Paylaş ! Google+ Paylaş ! Reddit Paylaş ! Pinterest Paylaş ! Linkedin Paylaş ! Tumblr Merhaba arkadaşlar bu yazımızda sizlerle Arduino ile dokunmatik TFT ekrana yazı yazdırmayı göreceğiz.Bu uygulamada SSD1289 LCD ekran sürücüsüne sahip 320×240 pixel ve 65K-16 bit renk çözünürlüğüne sahip TFT ekranı kullanacağız.Uygulamada programlama kartı olarak Arduino Mega’yı kullanacağız.Aşağıda kullanacağımız ekranın ön ve arka yüzü gösterilmiştir. Kullanılan Malzemeler Arduino Mega TFT Ekran Jumper Kablolar Dokunmatik ekranın pinleri aşağıda verilmiştir. Tft ekran ve Arduino MEGA bağlantı pinleri aşağıda verilmiştir. Programı yazmaya başlamadan önce UTFT kütüphanesini indirmemiz gerekmektedir.Aşağıda linki verilmiştir. http://www.rinkydinkelectronics.com/library.php?id=51 Kütüphanemizi indirdikten sonra uygulamamıza başlayabiliriz. [php]#include "UTFT.h" extern uint8_t SmallFont[]; extern uint8_t BigFont[]; extern uint8_t SevenSegNumFont[]; UTFT myGLCD(ITDB32S,38,39,40,41); void setup() { myGLCD.InitLCD(LANDSCAPE); myGLCD.clrScr(); } void bigFontTest() { myGLCD.clrScr(); myGLCD.setColor(255, 0, 0); myGLCD.setBackColor(0, 0, 0); myGLCD.setFont(BigFont); myGLCD.print("ABCDEFGHIJKLMNOPQRST", LEFT, 0); myGLCD.print("UVWXYZ[\\]^_ABCDEFGH", LEFT, 16); myGLCD.print("0123456789:;<=>?0123", LEFT, 32); myGLCD.print("`abcdefghijklmnopqrs", LEFT, 48); myGLCD.print("tuvwxyz{|}~ 01234567", LEFT, 64); myGLCD.print("ABCDEFGHIJKLMNOPQRST", LEFT, 80); myGLCD.print("~~~~~~~~~~~~~~~~~~~~", LEFT, 96); myGLCD.print("UVWXYZ[\\]^_ABCDEFGH", LEFT, 112); myGLCD.print("0123456789:;<=>?0123", LEFT, 128); myGLCD.print("`abcdefghijklmnopqrs", LEFT, 144); myGLCD.print("tuvwxyz{|}~ 01234567", LEFT, 160); myGLCD.print("ABCDEFGHIJKLMNOPQRST", LEFT, 176); myGLCD.print("UVWXYZ[\\]^_ABCDEFGH", LEFT, 192); myGLCD.print("0123456789:;<=>?0123", LEFT, 208); myGLCD.print("`abcdefghijklmnopqrs", LEFT, 224); } void smallFontTest() { myGLCD.clrScr(); myGLCD.setColor(0, 255, 0); myGLCD.setBackColor(0, 0, 0); myGLCD.setFont(SmallFont); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 0); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 12); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 24); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 36); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 48); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 60); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 72); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 84); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 96); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 108); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 120); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 132); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 144); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 156); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 168); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 180); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 192); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 204); myGLCD.print("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmn", LEFT, 216); myGLCD.print("opqrstuvwxyz[\\]^_0123456789`:;<=>?012345", LEFT, 228); } void hugeFontTest() { myGLCD.clrScr(); myGLCD.setColor(0, 0, 255); myGLCD.setBackColor(0, 0, 0); myGLCD.setFont(SevenSegNumFont); myGLCD.print("0123456789", LEFT, 0); myGLCD.print("0123456789", LEFT, 50); myGLCD.print("0123456789", LEFT, 100); myGLCD.print("0123456789", LEFT, 150); } void loop() { smallFontTest(); delay(1000); bigFontTest(); delay(1000); hugeFontTest(); delay(1000); } [/php] [php]#include <UTFT.h> // kullanılacak fontlar bildiriliyor. extern uint8_t SmallFont[]; extern uint8_t BigFont[]; extern uint8_t SevenSegNumFont[]; // bu değerler kullandığınız dokunmatik ekranın özelliğine göre değişebilir. UTFT myGLCD(ITDB32S,38,39,40,41); void setup() { myGLCD.InitLCD(); //LCD ekran kurulumu yapılıyor myGLCD.clrScr(); //Ekran temizlenir myGLCD.setColor(VGA_BLUE); //yazılan degerin rengi //myGLCD.setColor(0,0,255) bu şekildede kullanılır myGLCD.setBackColor(255,0,0); //yazının arka plan rengi myGLCD.fillScr(30,60,120); //Ekranı belirtilen renkte basar myGLCD.setFont(BigFont); myGLCD.print("ROBOTURKA.COM", CENTER, 50); myGLCD.setFont(BigFont); myGLCD.print("MUHAMMET OZCAN", CENTER, 150); } void loop() { //while(1) { }; }[/php] [php]#include <UTFT.h> extern uint8_t SmallFont[]; extern uint8_t BigFont[]; extern uint8_t SevenSegNumFont[]; UTFT myGLCD(ITDB32S,38,39,40,41); void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); } void loop() { myGLCD.setColor(0, 255, 0); myGLCD.setBackColor(0, 0, 0); myGLCD.setFont(BigFont); myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); myGLCD.print("0123456789:;<=>?", CENTER, 16); myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); myGLCD.print("`abcdefghijklmno", CENTER, 64); myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); myGLCD.setFont(SmallFont); myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); myGLCD.setFont(SevenSegNumFont); myGLCD.print("0123456789", CENTER, 190); while(1) {}; }[/php] [php]#include "UTFT.h" extern uint8_t BigFont[]; UTFT myGLCD(ITDB32S,38,39,40,41); void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); } void loop() { myGLCD.clrScr(); myGLCD.setColor(255, 255, 0); myGLCD.setBackColor(0, 0, 0); myGLCD.setFont(BigFont); myGLCD.print("Hello, world", 20, 20); for (int a=10; a<=90; a+=10) { myGLCD.print("Hello, world", 20, 20, a); } do {}while (1); } [/php]