#include <SPI.h> // this is needed for display
#include <ArduinoTrace.h>
//This display 320 x 240 pixels; TTGO display 240 x 135
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
char command;
int ledState = LOW; // Initial LED state (off)
int ledState2 = LOW; // Initial LED state (off)
int ledState3 = LOW; // Initial LED state (off)
void setup(void) {
Serial.begin(9600); // Start serial communication at 9600 baud
tft.init();
tft.setRotation(1); // Adjust rotation if needed
tft.fillScreen(TFT_BLACK);
tft.drawCircle(60,67,20,TFT_RED);
tft.drawCircle(120,67,20,TFT_GREEN);
tft.drawCircle(180,67,20,TFT_BLUE);
}
void loop() {
if (Serial.available() > 0) {
command = Serial.read();
if (command == 'T') {
ledState = !ledState; // Toggle LED state
if(ledState==HIGH) tft.fillCircle(60,67,15,TFT_RED);
else tft.fillCircle(60,67,15,TFT_BLACK);
}
if (command == 'S') {
ledState2 = !ledState2; // Toggle LED state
if(ledState2==HIGH) tft.fillCircle(120,67,15,TFT_GREEN);
else tft.fillCircle(120,67,15,TFT_BLACK);
}
if (command == 'L') {
ledState3 = !ledState3; // Toggle LED state
if(ledState3==HIGH) tft.fillCircle(180,67,15,TFT_BLUE);
else tft.fillCircle(180,67,15,TFT_BLACK);
}
}
}