/***************************************************
This is our GFX example for the Adafruit ILI9341 Breakout and Shield
----> http://www.adafruit.com/products/1651
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeSerif9pt7b.h>
#include <Fonts/FreeSerif12pt7b.h>
String status= "Run";
#include <FreeDefaultFonts.h>
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define TRANSPARENT 0x00FFFFFF
// 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() {
tft.begin();
tft.setRotation(0);
tft.fillScreen(BLACK);
tft.setFont(&FreeSerif9pt7b);
Serial.begin(115200);
//tft.setTextSize(2);
}
void loop(void) {
StartScreen();
}
void StartScreen(){
tft.setFont(&FreeSerif9pt7b);
tft.setCursor(15, 35);
tft.print("X: -999.564");
tft.setCursor(15, 65);
tft.print("Y: -999.123");
tft.setCursor(15, 95);
tft.print("Z: -999.123");
tft.drawRoundRect(10, 10, 220, 100, 2, RED);
tft.drawFastVLine(120,20,80, RED);
tft.setCursor(130, 35);
if (status == "Alarm"){tft.setTextColor(RED);
tft.print("Alarm");}
else if (status == "Run"){tft.setTextColor(YELLOW);
tft.print("Run");}
else if (status == "Idle"){tft.setTextColor(GREEN);
tft.print("Idle");}
tft.setTextColor(WHITE);
tft.setCursor(130, 65);
tft.print("Feed: 100%");
tft.setCursor(130, 95);
tft.print("Z: -999.123");
}