I cannot get yardButtonPin2 to work. it apparently stays HIGH even when its button is pushed the other two buttons work perfectly.
What should I be looking at to fix this.
Railway Yard-Siding Signalling V3.pdf (7.7 KB)
const int sidingButtonPin = 24;
//number of the siding pushbutton pin
const int yardButtonPin2 = 33;
//number of the second yard pushbutton pin
const int yardButtonPin = 26;
//number of first yard pushbutton pin
pinMode(sidingButtonPin, INPUT_PULLUP);
pinMode(yardButtonPin, INPUT_PULLUP);
pinMode(yardButtonPin2, INPUT_PULLUP);
void loop() {
// put your main code here, to run repeatedly:
// check if the siding putton is pressed, if it is, it's LOW
sidingButtonState = digitalRead(sidingButtonPin);
// check if the yard putton is pressed, if it is, it's LOW
yardButtonState = digitalRead(yardButtonPin);
if (yardButtonState == LOW) {
Serial.print("First Yard Button Pressed");
}
if (yardButtonState == HIGH) {
yardButtonState = digitalRead(YardButtonPin2);
if (yardButtonState == LOW) {
Serial.print("Second Yard Button Pressed");
}
}
if (sidingButtonState == LOW) {
//Serial.println("Siding Button Pushed");
ThrowSidingSwitch();
}
if (yardButtonState == LOW) {
Serial.println();
Serial.println("Yard Button Pushed");
ThrowYardSwitch();
}