i want the .....
digitalWrite(LED_BUILTIN, LOW);
analogWrite(EDS4, 0);
.......to stay off/low even with no ......
while (digitalRead(gearin1) == true )
......input. but when a new input is LOW then disregard that section of code.
i have been reading and searching since 8 this morning.
i have tryed some "while" and "if" stuff but cant get this latching
int gearin1 = A0; // six SHIFT INPUTS LOW/ACTIVCE
int gearin2 = A1;
int gearin3 = A2;
int gearin4 = A3;
int gearin5 = A4;
int gearin6 = A5;
int EDS1= 3; // solenoid outputS
int EDS2= 5;
int EDS3= 6;
int EDS4= 9;
int EDS5= 10;
int MV1 = 2;
void setup()
{
pinMode(gearin1, INPUT_PULLUP); // shift switch inputs
pinMode(gearin2, INPUT_PULLUP);
pinMode(gearin3, INPUT_PULLUP);
pinMode(gearin4, INPUT_PULLUP);
pinMode(gearin5, INPUT_PULLUP);
pinMode(gearin6, INPUT_PULLUP);
bool gearin1 = false; //for first gear
pinMode(EDS1, OUTPUT); // solenoid outputs
pinMode(EDS2, OUTPUT);
pinMode(EDS3, OUTPUT);
pinMode(EDS4, OUTPUT);
pinMode(EDS5, OUTPUT);
pinMode(MV1, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop(){
// FIRST GEAR
while (digitalRead(gearin1) == true )
{
analogWrite(EDS1, 240);
analogWrite(EDS2, 240);
analogWrite(EDS3, 0);
analogWrite(EDS4, 240);
analogWrite(EDS5, 0);
digitalWrite(MV1, LOW);
digitalWrite(LED_BUILTIN, HIGH);
delay (2000);
digitalWrite(LED_BUILTIN, LOW);
analogWrite(EDS4, 0);
}