#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
 
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

#define UP_BUTTON 2
#define DOWN_BUTTON 3
 
void setup() {
  Serial.begin(115200); // Any baud rate should work
  Serial.println("Hello Arduino\n");

  pinMode(UP_BUTTON, INPUT_PULLUP);
  pinMode(DOWN_BUTTON, INPUT_PULLUP);

  tft.begin();
  tft.setRotation(3);
  tft.fillScreen(ILI9341_BLACK);
  tft.setCursor(10, 2);
  tft.setTextColor(ILI9341_RED);
  tft.setTextSize(3);
 
  tft.drawRect(0,0,160,25,ILI9341_RED);              //  top part
  tft.drawRoundRect(7,60,146,58,5,ILI9341_RED);      //lower part
  tft.println("GOLF GTD");
 
}
 
void loop() { 
  static bool up_state = false;
  static bool down_state = false;
    
  up_state   = (digitalRead(UP_BUTTON) == LOW);
  down_state = (digitalRead(DOWN_BUTTON) == LOW);
  tft.setTextColor(ILI9341_RED, ILI9341_BLACK);
        
  if(up_state) 
  {
    tft.setCursor(60, 70);
    tft.print("BT1");
    } else {
      tft.setCursor(60, 70);
      tft.print("   ");
     }
  
  if(down_state) 
  {
    tft.setCursor(60, 70);
    tft.print("BT2");
    } else {
      tft.setCursor(60, 70);
      tft.print("   ");
     }
  }