#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
// For the Adafruit shield, these are the default.
#define TFT_DC A3
#define TFT_CS A5
#define TFT_RST A4
#define TFT_MISO 12
#define TFT_MOSI 11
#define TFT_CLK 13
int data;
// 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);
void setup() {
Serial.begin(9600);
Serial.println("ILI9341 Test!");
tft.begin();
randomSeed(analogRead(A1));
tft.fillScreen(ILI9341_BLACK);
}
void loop() {
data = random(0, 200);
tft.setRotation(3);
tft.setCursor(0, 0);
tft.setTextSize(17);
tft.print(data);
delay(1000);
tft.fillScreen(ILI9341_BLACK);
}
Comments