Thread: AutoTop DIY
View Single Post
Old 06-27-2014, 07:47 AM   #57
Polaris
Registered User
 
Join Date: Apr 2013
Location: Springfield, Oregon
Posts: 62
I'm pretty sure the last switch statement should just look like:

default: //no movement currently
if(openBtnCount > 0) {
openMode = 1;
movementCount = openTime;
digitalWrite(closeBtnOut, LOW);
digitalWrite(openBtnOut, HIGH);
} else if(closeBtnCount > 0) {
openMode = 2;
movementCount = closeTime;
digitalWrite(closeBtnOut, HIGH);
digitalWrite(openBtnOut, LOW);
} else {
allStop();
}

I'm also pretty sure the "movementCount -= loopInterval;" lines shouldn't be in the case 3 and case 4 and default switches. They are unnecessary in case 3 and 4, and constantly decremented when there is no motion in the default case.
Polaris is offline   Reply With Quote