The ShellminatorLevelMeter class is very similar to the ShellminatorProgress class, with the main difference being in its visual representation. In terms of code, the basic usage is almost identical.
Live Demo
Whole Code
uint32_t timerStart = 0;
uint32_t period = 100;
float percentage = 1.0;
float step = 1.0;
void setup(){
Serial.begin(115200);
shell.clear();
Serial.println( "Program Start!" );
shell.begin( "arnold" );
shell.beginScreen( &meter );
}
void loop(){
if( ( millis() - timerStart ) > period ){
timerStart = millis();
percentage += step;
if( percentage > 100.0 ){
step = -1.0;
percentage = 100.0;
}
if( percentage < 0.0 ){
step = 1.0;
percentage = 0.0;
}
meter.setPercentage( percentage );
}
shell.update();
}