Files
J1B3-Sensor-boxes/arduino/Screen code/Screen-code-full/Screen-code-full.ino
2024-03-12 16:24:26 +01:00

44 lines
1.0 KiB
C++

#include "headerFile.h"
int i = 0;
char* Question[] = {
"How clean are the toilets?",
"How clean is the study area?",
"What do you think of the temperature in the study area?",
"How crowded would you say the study area is?",
"Is there enough help available?"
};
char* Answer[] = {
"clean, normal, disgusting",
"clean, normal, disgusting",
"hot, perfect, cold",
"not at all, its fine, really crowded",
"no, decently, yes"
};
//simplify the name of the library
Adafruit_ST7796S_kbv tft = Adafruit_ST7796S_kbv(TFT_CS, TFT_DC, MOSI, SCK, TFT_RST, MISO);
DisplayText displayText(tft);
void setup() {
tft.begin(); // Initialize the display
tft.setRotation(3); // Set the rotation to horizontal
}
void loop() {
i++;
if (i == 5) {
i = 0;
}
tft.fillScreen(ST7796S_BLACK); // Fill the screen with black color
// writeText(Question[0], 2, 50, 0, 0);
// writeText(Answer[0], 2, 50, 300, 4000);
displayText.writeText(Question[i], 3, 0, 0, 0, true, false);
displayText.writeText(Answer[i], 3, 0, 200, 0, true, true);
delay(2000);
}