It works if you move the enum class and cycleToString function declaration aboveto the void setup()top, i.e.:
enum class CYCLE { TypeA, TypeB };
void setup()
{
// setup code
}
String cycleToString (CYCLE cycle) {
if (cycle == CYCLE::TypeA) {
return "TypeA";
}
else if (cycle == CYCLE::TypeB) {
return "TypeB";
}
return "Undefined";
}
void setup()
{
// setup code
}
void loop()
{
// loop code
}