Ha! Don't worry, I'm highly regulated and everything I do gets tested and has an abort method. This is my first project and, even though simple for everyone else on here, I've learned a lot! The completed code is below. It has been tested with LEDs and does what I'm looking for.
int button1 = 0;
int button2 = 1;
int limitOpen = 2;
int limitDeploy = 3;
int limitDown = 4;
int limitUp = 5;
int limitStow = 6;
int limitClose = 7;
int Open = 8;
int Close = 9;
int deploy = 10;
int stow = 11;
int down = 12;
int up = 13;
void setup() {
// put your setup code here, to run once:
pinMode (button1, INPUT_PULLUP);
pinMode (button2, INPUT_PULLUP);
pinMode (limitOpen, INPUT_PULLUP);
pinMode (limitDeploy, INPUT_PULLUP);
pinMode (limitDown, INPUT_PULLUP);
pinMode (limitUp, INPUT_PULLUP);
pinMode (limitStow, INPUT_PULLUP);
pinMode (limitClose, INPUT_PULLUP);
pinMode (Open, OUTPUT);
pinMode (Close, OUTPUT);
pinMode (deploy, OUTPUT);
pinMode (stow, OUTPUT);
pinMode (down, OUTPUT);
pinMode (up, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(button1) == HIGH)
{
Down();
}
else if (digitalRead(button2) == HIGH)
{
Up();
}
else
{
for (int i = 8; i <= 13; i++){
// all outputs (8-13) set to low
digitalWrite(i, HIGH);
}
}
}
void Down() {
if (digitalRead(limitOpen)==LOW && digitalRead(limitDeploy)==LOW && digitalRead(limitDown)==LOW)
{
digitalWrite (Open, LOW);
}
else if (digitalRead(limitOpen)==HIGH && digitalRead(limitDeploy)==LOW && digitalRead(limitDown) == LOW)
{
digitalWrite (Open, HIGH);
digitalWrite (deploy, LOW);
}
else if (digitalRead(limitOpen)==HIGH && digitalRead(limitDeploy)==HIGH && digitalRead(limitDown) == LOW)
{
digitalWrite (deploy, HIGH);
digitalWrite (down, LOW);
}
else if (digitalRead(limitOpen)==HIGH && digitalRead(limitDeploy)==HIGH && digitalRead(limitDown) == LOW)
{
digitalWrite (deploy, HIGH);
digitalWrite (down, LOW);
}
}
void Up() {
if (digitalRead(limitUp)==LOW && digitalRead(limitStow)==LOW && digitalRead(limitClose) == LOW)
{
digitalWrite (up, LOW);
}
else if (digitalRead(limitUp)==HIGH && digitalRead(limitStow)==LOW && digitalRead(limitClose) == LOW)
{
digitalWrite (up, HIGH);
digitalWrite (stow, LOW);
}
else if (digitalRead(limitUp)==HIGH && digitalRead(limitStow) == HIGH && digitalRead(limitClose) == LOW)
{
digitalWrite (stow, HIGH);
digitalWrite (Close, LOW);
}
}
It's very expensive to be paralyzed, controllers for these vans are around $1000. I've gotten a few old vans going again just bypassing the controller and using relay logic, but this adds a new button for every function. The next one I get in will be fixed with a $6 controller and work just like factory. Oh, and it will all be wired through a "Holy shit! Stop everything!" button...I have those in stock.
On another question, the relay board I bought is active low. This seems counter intuitive to me, is there a reason this might be better than active high?