The result of a digitalRead() call is either HIGH or LOW and not a numeric character as your code
if (PiState == 4 - '0') {
assumes .
The result of a digitalRead() call is either HIGH or LOW and not a numeric character as your code
if (PiState == 4 - '0') {
assumes .