edgemoron:
Looking at your Fritz, looks like buttons are switching high side but you have pull UP resistors, so the input pins will always read HIGH whether the buttons are pressed or not.
My understanding of pull up resistors is that when button is not pressed, the input reads HIGH and when pressed the input reads LOW. Based on this i tried changing the if statement within the loop to check for LOW state rather than high, however the motor still continues to spin without either button pressed (see previous post for rest of code):
// loop
void loop() {
if (RaiseButtonState == LOW && LowerButtonState == HIGH){ //If the raise button is pressed and lower button isnt,
digitalWrite(enablePin, HIGH); //then turn the motor on
digitalWrite(ClockwisePin, HIGH); //clockwise
digitalWrite(AntiClockPin, LOW);
}
if (LowerButtonState == LOW && RaiseButtonState == HIGH){ //If the lower button is pressed and raise button isnt
digitalWrite(enablePin, HIGH); //then turn the motor on
digitalWrite(ClockwisePin, LOW); //anti clockwise
digitalWrite(AntiClockPin, HIGH);
}
}
//end of loop