/*
Example animated analogue meters
Needs Font 2 (also Font 4 if using large scale label)
Make sure all the display driver and pin connections are correct by
editing the User_Setup.h file in the TFT_eSPI library folder.
#########################################################################
###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
#########################################################################
Requires widget library here:
https://github.com/Bodmer/TFT_eWidget
*/
#include <TFT_eSPI.h> // Hardware-specific library
#include <TFT_eWidget.h> // Widget library
//#include <FS.h>
//#include "Free_Fonts.h" // Include the header file attached to this sketch
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
MeterWidget liter = MeterWidget(&tft);
//MeterWidget volts = MeterWidget(&tft);
//MeterWidget ohms = MeterWidget(&tft);
#define LOOP_PERIOD 15 // Display updates every 35 ms
void setup(void)
{
tft.init();
tft.setRotation(1);
Serial.begin(115200); // For debug
// Colour zones are set as a start and end percentage of full scale (0-100)
// If start and end of a colour zone are the same then that colour is not used
// --Red-- -Org- -Yell- -Grn-
liter.setZones(0, 10, 10, 20, 0, 0, 20, 120); // Example here red starts at 75% and ends at 100% of full scale
// Meter is 239 pixels wide and 126 pixels high
liter.analogMeter(0, 30, 120, "Liter", "0", "30", "60", "90", "120"); // Draw analogue meter at 0, 30
}
void loop()
{
float current;
current = 95;
//Serial.print("I = "); Serial.print(current);
liter.updateNeedle(current, 0);
tft.setTextColor(TFT_ORANGE, TFT_BLACK);// Set text colour to orange with black background
//tft.drawString("Test", 160, 60, 4);// Print the string name of the font
//tft.drawString("TEST", 160, 120, 4);// Print the string name of the font. Draw text at position 120,260 using fonts 4
tft.drawCentreString("Wasserstand",120,0,4);
delay(1000);
}