IK denk dat ik het al gevonden heb
void showMenu(int counter) {
LCD.clear();
LCD.setCursor(0, 0);
LCD.print("--->");
LCD.setCursor(5, 0);
LCD.print(menuItems[counter % NUMELEMENTS(menuItems)]);
LCD.setCursor(5, 1);
LCD.print(menuItems[(counter + 1) % NUMELEMENTS(menuItems)]);
};
void setup() {
LCD.begin(16, 2);
for (uint8_t cnt = 0; cnt < NUMELEMENTS(buttonList); cnt++) {
pinMode(buttonList[cnt].pin, INPUT_PULLUP);
}
Serial.begin(9600);
showMenu(choice);
Serial.println("RW");
sprintf(buffer, "Het adres van menuItems[0] = %p", &menuItems[0]);
Serial.println(buffer);
sprintf(buffer, "Het adres van menuItems[1] = %p", &menuItems[1]);
Serial.println(buffer);
sprintf(buffer, "Het adres van menuItems[2] = %p", &menuItems[2]);
Serial.println(buffer);
}
void buttonUp()
{
if (choice > 0) {
choice--;
} else {
choice = 2;
}
Serial.print("Waarde counter : ");
Serial.println(choice);
}
void selectChoice()
{
selectedChoice = choice ;
Serial.print("U hebt gekozen voor ");
Serial.println(menuItems[selectedChoice]);
}
void buttonDown()
{
++choice;
Serial.print("Waarde counter : ");
Serial.println(choice);
}
Dit lijkt eeuwig door te scrollen.