/*
"increment" an enum
https://forum.arduino.cc/t/incrementing-enum-value/1289156/8
2024-08-06 by noiasca
2024-11-01 to be deleted
*/
enum Mode {
fixed,
changing,
music
};
Mode currentMode = fixed;
void next(Mode &in) {
switch (in) {
case fixed: in = changing; break;
case changing: in = music; break;
case music : in = fixed;
}
}
void readable(Mode in) {
switch (in) {
case fixed: Serial.println(F("fixed")); break;
case changing: Serial.println(F("changing")); break;
case music : Serial.println(F("music"));
}
}
void setup() {
Serial.begin(115200);
Serial.println(F("n for next"));
}
void loop() {
if (Serial.read() == 'n') {
next(currentMode);
readable(currentMode);
}
}