stowite:
The result of a digitalRead() call is either HIGH or LOW and not a numeric character as your codeif (PiState == 4 - '0') {assumes .
So it should be
if (PiState == HIGH) {
digitalWrite(piPin1 , !digitalRead(piPin1));
}
else if{
digitalWrite(piPin2, !digitalRead(piPin2));
}