Hi all,
I've been searching all over the net to find how to code such a level meter on a TFT (ILI9341_t3),wich have those colors:
I don't really need the segments,but who knows who can do that...
I'm taking this exerpt from scratch:
I woud like to make the green color first show up to a certain level,then followed by orange and then followed by red in the same bar
and in this principe of level growing up.
All suggestions are welcome
I've been searching all over the net to find how to code such a level meter on a TFT (ILI9341_t3),wich have those colors:
I don't really need the segments,but who knows who can do that...
I'm taking this exerpt from scratch:
Code:
float leftNumber = peak1.read();
float rightNumber = peak2.read();
Serial.print(leftNumber);
Serial.print(", ");
Serial.print(rightNumber);
Serial.println();
// draw the verticle bars
int height = leftNumber * 200;
tft.fillRect(20, 280 - height, 40, height, ILI9341_GREEN);
tft.fillRect(20, 280 - 200, 40, 200 - height, ILI9341_BLACK);
height = rightNumber * 200;
tft.fillRect(65, 280 - height, 40, height, ILI9341_GREEN);
tft.fillRect(65, 280 - 200, 40, 200 - height, ILI9341_BLACK);
// a smarter approach would redraw only the changed portion...
I woud like to make the green color first show up to a certain level,then followed by orange and then followed by red in the same bar
and in this principe of level growing up.
All suggestions are welcome