Should the second part of the code, the checking of the state of the motor, be in the main loop or should I modify my motor function?
void motor(int counter){
mtrCount = counter;
if (mtrState == mtrOn){
digitalWrite(motPIN, HIGH);
mtrCount --;
if (mtrCount <= 0){
// time's up, so stop
mtrState == mtrOff;
}
}
if (mtrState == mtrOff){
digitalWrite(motPIN, LOW);
mtrState = mtrStable;
}
...