Now the big question is where do I find a code that'll fit my needs? I need 1 button to control the U/D of the 12vdc motor, and the reed sensors to have the windows stop while going up or down... I found a code that I think will help for the reed sensors but idk?
I know this code isn't going to help cause it only has 1 reed sensor in the program?
const int switchPin = 2; // // Reed switch to digital pin 2
int ledPin= 13; // // LED is on digital pin 13
int state = HIGH; // the current state of the output pin
int reading; // the current reading from the input pin
int previous = LOW; // the previous reading from the input pin
void setup() {
pinMode(switchPin, INPUT); // switchPin is an input
pinMode (ledPin, OUTPUT); // ledPin is an output
digitalWrite(switchPin, HIGH); // Activate internal pullup resistor
Serial.begin(9600);
}
void loop() {
int reading = digitalRead(switchPin);
Serial.println(digitalRead(switchPin)); // Display current value
delay (200);
if (reading == HIGH && previous == LOW) {
if (state == HIGH)
state = LOW;
else
state = HIGH;
}
digitalWrite(ledPin, state);
previous = reading;
}