int statepl = 3;
Since this is in setup() statepl is not reachable in loop.
Look up C++ scope.
Put int statepl = 3; before setup() i.e. make it global.
.
int statepl = 3;
Since this is in setup() statepl is not reachable in loop.
Look up C++ scope.
Put int statepl = 3; before setup() i.e. make it global.
.