//board STM32F103C9T6 (64Kb**(64Kb you should beliefe but STM building in 128KB and sellers dont tell)** 72Mhz) || tft: ILI9341 (240x320pixel 2,8" COLOR LCD SPI) || testprogramm uses Adafruit library have fun =^.^= marderchen //pins TFT ::VCC on 3.3V ::LED on 3.3V ::GND on GND :: CS on A0 :: Reset on A1 :: DC/RS on A2 :: SCK on A5 :: MISO on A6 :: MOSI on A7 //pins touch T_clk = PB13 | T_cs = PA8 | T_din = MOSI = PB15 | T_D0 = PB13 | T_IRQ = PB12 //short version only rainbowing text (touch not used) MEOW! #include "SPI.h" #include "Adafruit_GFX_AS.h" #include "Adafruit_ILI9341_STM.h" #include "XPT2046_touch.h" #define TFT_CS PA0 #define TFT_DC PA2 #define TFT_RST PA1 #define CS_PIN PA8 // Chip Select pin Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST); // Use hardware SPI SPIClass mySPI(2); //Create an SPI instance on SPI1 port. XPT2046_touch ts(CS_PIN, mySPI); // Chip Select pin, SPI port its not the chip from touchmodule but working fine //the rainbowspectrum in 128steps uint32_t rainbow[129] = {0xff0000,0xff0500,0xff0a00,0xff0f00,0xff1400,0xff1900,0xff1e00,0xff2400,0xff2900,0xff2e00,0xff3300,0xff3800,0xff3d00,0xff4200,0xff4700,0xff4c00,0xff5100,0xff5600,0xff5b00,0xff6100,0xff6600,0xff6b00,0xff7000,0xff7500,0xff7a00,0xff7f00,0xff8400,0xff8900,0xff8e00,0xff9300,0xff9800,0xff9d00,0xffa100,0xffa600,0xffab00,0xffb000,0xffb500,0xffba00,0xffbf00,0xffc400,0xffc900,0xffce00,0xffd300,0xffd800,0xffdd00,0xffe100,0xffe600,0xffeb00,0xfff000,0xfff500,0xfffa00,0xffff00,0xf5ff00,0xebff00,0xe0ff00,0xd6ff00,0xccff00,0xc2ff00,0xb8ff00,0xadff00,0xa3ff00,0x99ff00,0x8fff00,0x85ff00,0x7aff00,0x70ff00,0x66ff00,0x5cff00,0x52ff00,0x47ff00,0x3dff00,0x33ff00,0x29ff00,0x1fff00,0x14ff00,0x0aff00,0x00ff00,0x00ff0a,0x00ff14,0x00ff1d,0x00ff27,0x00ff31,0x00ff3b,0x00ff45,0x00ff4e,0x00ff58,0x00ff62,0x00ff6c,0x00ff76,0x00ff80,0x00ff89,0x00ff93,0x00ff9d,0x00ffa7,0x00ffb1,0x00ffba,0x00ffc4,0x00ffce,0x00ffd8,0x00ffe2,0x00ffeb,0x00fff5,0x00ffff,0x00f5ff,0x00ebff,0x00e0ff,0x00d6ff,0x00ccff,0x00c2ff,0x00b8ff,0x00adff,0x00a3ff,0x0099ff,0x008fff,0x0085ff,0x007aff,0x0070ff,0x0066ff,0x005cff,0x0052ff,0x0047ff,0x003dff,0x0033ff,0x0029ff,0x001fff,0x0014ff,0x000aff,0x0000ff}; int r =0; int g =0; int b =0; int rainbowcounter =0; void setup() { tft.begin(); tft.setRotation(3); tft.fillScreen(ILI9341_BLACK); } void loop() { tft.setCursor(10,10); tft.setTextSize(3); rainbowcounter++; //counting up rainbow +=2; faster etc.. if (rainbowcounter >128) {rainbowcounter=0;} //for looping colory(rainbow[rainbowcounter]); // write the color needet to be translatet or use a changing one from rainbowarray tft.setTextColor(tft.color565(r,g,b)); // place -> tft.color565(r,g,b) <- instead of the color the r,g, and b 0-255value is output from colory tft.println(" RAIBNBOW LCD "); //text changed in color tft.setCursor(35,40); tft.setTextSize(2); tft.println("by marderchen =^.^="); } void colory(uint32_t colorz) { String hexcolor = String(colorz); int number = hexcolor.toInt(); r = number >> 16; g = number >> 8 & 0xFF; b = number & 0xFF; }