#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "dragon.h"
#define TFT_DC 9
#define TFT_CS 10
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
//Adafruit_GFX_Button btn[12];
int c = 0;
void setup() {
tft.begin();
//btn[1].initButton(&tft, 40, 100, 60, 40, 0xFFFF, 0xF0F0, 0x0000, "1", 2);
/*tft.setCursor(26, 120);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(3);
tft.println("Ciao Mondo!");
tft.setCursor(20, 160);
tft.setTextColor(ILI9341_BLUE);
tft.setTextSize(2);
tft.println("Posso scegliere?");*/
}
/*void loop() {
c++;
tft.setCursor(40, 200);
tft.setTextColor(ILI9341_YELLOW, ILI9341_BLACK);
tft.setTextSize(4);
tft.println(c);
delay(1000);
}*/
void loop(void) {
for(uint8_t r=0; r<4; r++) {
tft.setRotation(r);
tft.fillScreen(ILI9341_BLACK);
for(uint8_t j=0; j<20; j++) {
tft.drawRGBBitmap(
random(-DRAGON_WIDTH , tft.width()),
random(-DRAGON_HEIGHT, tft.height()),
#if defined(__AVR__) || defined(ESP8266)
dragonBitmap,
#else
// Some non-AVR MCU's have a "flat" memory model and don't
// distinguish between flash and RAM addresses. In this case,
// the RAM-resident-optimized drawRGBBitmap in the ILI9341
// library can be invoked by forcibly type-converting the
// PROGMEM bitmap pointer to a non-const uint16_t *.
(uint16_t *)dragonBitmap,
#endif
DRAGON_WIDTH, DRAGON_HEIGHT);
delay(1); // Allow ESP8266 to handle watchdog & WiFi stuff
}
delay(3000);
}
}