#include "SPI.h"
#include "ILI9341_t3.h"
#include "font_ArialBold.h"
#define TFT_DC 9
#define TFT_CS 10
#define TFT_RST 8
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST);
elapsedMillis sincePrint;
int buttonPin1= 14; //sets pins buttons are connected to
int buttonState1 = 0; // current state of the button
int lastButtonState1 = 0; // previous state of the button
int buttonPin2= 15;
int buttonState2 = 0; // current state of the button
int lastButtonState2 = 0; // previous state of the button
int buttonPin3= 16;
int buttonState3 = 0; // current state of the button
int lastButtonState3 = 0; // previous state of the button
int buttonPin4= 17;
void setup() {
tft.begin();
tft.setRotation(1);
tft.fillScreen(ILI9341_BLACK);
tft.drawLine(0, 55, 350, 55, ILI9341_WHITE);
pinMode(buttonPin1, INPUT_PULLUP); //assigns button pins as inputs //currently pulled high
pinMode(buttonPin2, INPUT_PULLUP); //currently pulled low
pinMode(buttonPin3, INPUT_PULLUP); //currently pulled low
pinMode(buttonPin4, INPUT_PULLUP); //currently pulled low
}
void loop(void) {
int buttonState1 = digitalRead(buttonPin1);
int buttonState2 = digitalRead(buttonPin2);
int buttonState3 = digitalRead(buttonPin3);
int buttonState4 = digitalRead(buttonPin4);
tft.setCursor(0, 70);
if(buttonState1== LOW) {
tft.setFont(Arial_14_Bold);
tft.setTextColor(ILI9341_YELLOW);
tft.println(" TACOS");
}
if (buttonState1 != lastButtonState1) {
tft.fillRect(0, 70, 250, 300,ILI9341_BLACK);
}
lastButtonState1 = buttonState1;
if(buttonState2== LOW) {
tft.setFont(Arial_14_Bold);
tft.setTextColor(ILI9341_RED);
tft.println(" BURGERS");
}
if (buttonState2 != lastButtonState2) {
tft.fillRect(0, 70, 250, 300,ILI9341_BLACK);
}
lastButtonState2 = buttonState2;
if(buttonState3== LOW) {
tft.setFont(Arial_14_Bold);
tft.setTextColor(ILI9341_GREEN);
tft.println(" FRENCH FRIES");
}
if (buttonState3 != lastButtonState3) {
tft.fillRect(0, 70, 250, 300,ILI9341_BLACK);
}
lastButtonState3 = buttonState3;
}