Your task is to declare a scoped enum class named PinState representing the logic level of a GPIO pin.
Requirements:
LowHighuint8_t as its underlying type.Implement a function:
const char* toString(PinState s)
which returns:
"LOW" for PinState::Low"HIGH" for PinState::High
The program will:
xx is guaranteed to be either 0 or 10 → PinState::Low1 → PinState::HighNo other input values will be provided.
Input / Output Specification
Input:
A single integer x where:
x == 0 represents a LOW GPIO statex == 1 represents a HIGH GPIO stateOutput:
Print exactly one of the following strings (no newline required):
LOWHIGH
Example 1
Input:
0
Output:
LOW
Example 2
Input:
1
Output:
HIGH
Expected Output
LOW