void loop(){
count+=1;
double MaxBatteryBar=20;
double battery_bars_pixels,bottom_rect_y = 6;
batteryPercent = count;
// for (batteryPercent;batteryPercent<100;batteryPercent++ )
// {battery_bars_pixels =batteryPercent*MaxBatteryBar/100 ;
display.setCursor(99,5);
display.setTextSize(1);
display.setTextColor(BLACK);
switch (buttonPushCounter) {
case 2:
settings_voltagesetup();
voltage_setup();
break;
case 3:
settings_batteryinfo();
battery_info();
break;
case 4:
settings_poweroff();
poweroff();
break;
case 5:
settings_exit();
exit();
break;
default:
attributes();
charge_status();
protection();
break;
}
display.display();
delay(400);
button();
}
// Define functions to call back
void button(){
bool redraw=false;
buttonState = digitalRead(buttonPin);
if (buttonState != lastButtonState) {
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// went from off to on:
redraw=true;
buttonPushCounter++; // add one to counter
if (buttonPushCounter > 5) {
buttonPushCounter = 1;
}
Serial.println(buttonPushCounter);
}
lastButtonState = buttonState;
}
if (redraw == true ) {
display.clearDisplay();
}
}
THIS IS MY CODE TO NAVIGATE THROUGH THE PAGES. MY CONCERN IS THAT HOW SHOULD I NAVIGATE INSIDE THE PAGE.
FOR THE PHOTO UPLOADED I WANT THAT IF I PRESS THE BUTTON TWO TIMES IT SHOULD ENTER THE POWER OFF PAGE AND I SHOULD SELECT ONE OF THE OPTIONS PRESENT THERE THAT IS ON AND OFF.
AND FOR SELECTION I WILL PRESS AND HOLD THE BUTTON FOR 2 TO 3 SECONDS FOR THE SELECTION TO GET REGISTERED.
I AM USING ARDUINO IDE AND CPP LANGUAGE