// Color definitions #define BLACK 0x0000 /* 0, 0, 0 */ #define NAVY 0x000F /* 0, 0, 128 */ #define DARKGREEN 0x03E0 /* 0, 128, 0 */ #define DARKCYAN 0x03EF /* 0, 128, 128 */ #define MAROON 0x7800 /* 128, 0, 0 */ #define PURPLE 0x780F /* 128, 0, 128 */ #define OLIVE 0x7BE0 /* 128, 128, 0 */ #define LIGHTGREY 0xC618 /* 192, 192, 192 */ #define DARKGREY 0x7BEF /* 128, 128, 128 */ #define BLUE 0x001F /* 0, 0, 255 */ #define GREEN 0x07E0 /* 0, 255, 0 */ #define CYAN 0x07FF /* 0, 255, 255 */ #define RED 0xF800 /* 255, 0, 0 */ #define MAGENTA 0xF81F /* 255, 0, 255 */ #define YELLOW 0xFFE0 /* 255, 255, 0 */ #define WHITE 0xFFFF /* 255, 255, 255 */ #define ORANGE 0xFD20 /* 255, 165, 0 */ #define GREENYELLOW 0xAFE5 /* 173, 255, 47 */ #define PINK 0xF81F #define DEBUG #include // Core graphics library #include // Hardware-specific library // The control pins for the LCD can be assigned to any digital or // analog pins...but we'll use the analog pins as this allows us to // double up the pins with the touch screen (see the TFT paint example). #define LCD_RD A0 // LCD Read goes to Analog 0 #define LCD_WR A1 // LCD Write goes to Analog 1 #define LCD_CD A2 // Command/Data goes to Analog 2, Labled LCD_RS #define LCD_CS A3 // Chip Select goes to Analog 3 #define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin // Assign human-readable names to some common 16-bit color values: // Set for inverted color display. #define BLACK 0xFFFF //65523-65535 #define BLUE 0xFFE0 //65504-65522 #define BRIGHTBLUE 0xFD20 #define GREEN 0xF81F #define CYAN 0xF800 #define LIGHTBLUE 0xF400 #define BLUE2 0xAFE5 #define GRAY1 0x8410 #define RED 0x07FF //define BRIGHT_RED 0x???? #define GRAY2 0x4208 #define WHITE3 0x1000 #define W+PINK4 0x0D00 #define W+PINK3 0x0C00 #define W+PINK2 0x0B00 #define W+PINK 0x0A00 #define WHITE2 0x0800 #define MAGENTA 0x07E0 #define PINK3 0x0500 #define PINK2 0x0400 #define PINK 0x03E0 #define YELLOW 0x001F #define WHITE 0x0000 #define TESTCOL 0xF71F Adafruit_ILI9341_8bit_AS tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); void setup(void) { tft.reset(); delay(10); tft.begin(0x9341); tft.fillScreen(BLACK); Serial.begin(9600); } void loop() { //for(unsigned int i=0x0000;i<0xFFFF;i++) //for(unsigned int i=0b1111111111110000;i<0b1111111111111111;i++) //for(unsigned int i=65523;i<65535;i++) //for(unsigned int i=63519;i<63680;i++) //delay(1000); { #ifdef DEBUG while (!Serial.available()); unsigned int i = Serial.read(); //unsigned int a = Serial.read(); //unsigned int b = Serial.read(); //unsigned int c = Serial.read(); //unsigned int d = Serial.read(); #else delay(500); #endif // DEBUG delay(1000); Serial.println(i); delay(2000); tft.fillScreen(i); delay(2000); } //LCD_Clear(0x0000); }