Thread: AutoTop DIY
View Single Post
Old 06-27-2014, 08:12 AM   #58
JayG
On the slippery slope
 
JayG's Avatar
 
Join Date: Mar 2014
Location: Austin and Palm Springs
Posts: 3,794
Garage
Quote:
Originally Posted by Polaris View Post
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.
just tried those changes and the output still does not stay high except for the time when the switch is closed, in other words no auto operation.

I am using the onboard LED (pin 13) as the output for testing as it is easier than uploading the code and installing in the car to test
__________________
2004 Boxster S 6 speed - DRL relay hack, Polaris AutoTop DIY
2004 996 Targa Tip
Instructor - San Diego region
2014 Porsche Performance Driving School
2020 BMW X3, 2013 Ram 1500, 2016 Cmax, 2004 F-150 "Big Red"
JayG is offline   Reply With Quote