//Code By A.Tedds. //Adafruit Library Files //Usage of tft.drawRect(start position 0-240,0-320,size 0-240,size 0-320, Color) #include // Core graphics library #include // Hardware-specific library #define LCD_CS A3 // Chip Select goes to Analog 3 #define LCD_CD A2 // Command/Data goes to Analog 2 #define LCD_WR A1 // LCD Write goes to Analog 1 #define LCD_RD A0 // LCD Read goes to Analog 0 #define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin //Assign human-readable names to some common 16-bit color values: #define BLACK 0xFFFF #define BLUE 0xFFE0 #define GREEN 0xF81F #define CYAN 0xF800 #define GRAY1 0x8410 #define RED 0x07FF #define BRIGHT_RED 0x0000 #define GRAY2 0x4208 #define MAGENTA 0x07E0 #define YELLOW 0x001F #define WHITE 0x0000 //#define tft.width 320 //#define tft.height 240 //Need code for inversion //boolean i=true; //tft.invertDisplay(true); Adafruit_ILI9341_8bit_AS tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); void setup() { // put your setup code here, to run once: tft.reset(); uint16_t identifier = tft.readID(); tft.begin(identifier); tft.fillScreen(BLACK); } //START LOOP // put your main code here, to run repeatedly: void loop(void) { // rotatePixel(); // rotateLine(); rotateFastline(); //rotateDrawrect(); // rotateFillrect(); // rotateDrawcircle(); // rotateFillcircle(); // rotateText(); } //START LOOP // put your main code here, to run repeatedly: void rotateFastline(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(BLACK); //Serial.println(tft.getRotation(), DEC); tft.drawFastHLine(0, 20, tft.width(), RED); tft.drawFastVLine(20, 0, tft.height(), BLUE); while (!Serial.available()); //Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); } } void rotateDrawrect(void) { for (uint8_t i=0; i<4; i++) { //tft.fillScreen(BLACK); //Serial.println(tft.getRotation(), DEC); tft.drawRect(70, 100, 100, 100, GREEN); delay(100); tft.drawRect(70, 100,100,100, BLACK); delay(100); //while (); //Serial.read(); Serial.read(); Serial.read(); //tft.setRotation(tft.getRotation()+1); } } //tft.drawRect(60, 100, 125, 125, BLUE); //delay(500); //tft.drawRect(60, 100, 125, 125, WHITE); //draw an open rectangle around the edge of the screen //tft.drawRect(0,1,240,319, BLUE); //delay(500); //tft.fillScreen(BLACK); //tft.drawRect(60, 100, 125, 125, GREEN); //delay(500); //tft.drawRect(60, 100, 125, 125, WHITE); //draw an open rectangle around the edge of the screen //tft.drawRect(0,1,240,319, GREEN); //delay(500); //REPEAT