Just realised i had my pull up resistors wired to the 9V line as opposed to ground. This is going to be a long journey isn't it haha. Seems to be working fine now, although motor doesn't stop when buttons are released. I'm sure i can figure that out though. Thanks for the input everyone, still used all tips to make it work.
Final code (feel free to critique further):
// define constants
const int RaiseButton = 13; //The button to raise the actuator is wired to pin 13
const int LowerButton = 11; //The button to lower the actuator is wired to pin 11
const int ClockwisePin = 4; //The input 3 into H-Bridge is wired to pin 4
const int AntiClockPin = 2; //The input 4 into H-Bridge is wired to pin 2
const int enablePin = 7;
// setup
void setup() {
pinMode(RaiseButton, INPUT); //Sets the raise button as an input
pinMode(LowerButton, INPUT); //Sets the lower button as an input
pinMode(ClockwisePin, OUTPUT); //Sets the input to the H-Bridge as an output
pinMode(AntiClockPin, OUTPUT); //Sets the input to the H-Bridge as an output
pinMode(enablePin, OUTPUT);
}
// loop
void loop() {
int RaiseButtonState = digitalRead(RaiseButton); //Read and store the state of the Raise Button
int LowerButtonState = digitalRead(LowerButton); //Read and store the state of the Lower Button
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