Hello Arduino Stack Exchange,
I have an an enum instance called state:
enum States
{
SLEEP,
AWAKE,
CRAZY
} state;
States state = SLEEP;
I would like to convert the value of state to a String so I can serially print it using Serial.println().
Currently, when I type String(state), I get a value 0, 1, etc. I suppose this corresponds with the index of the enum's key.
How can I get it to return "SLEEP", "AWAKE", etc.?
arraysis a hint towards the solutionStates state = IDLE;will not compile :)enumcases,IDLEwas one of them. I updated the question to remove it