Question: I have made sure all my hardware is wired correctly to the best of knowlege but when i run the program and press each button

I have made sure all my hardware is wired correctly to the best of knowlege but when i run the program and press each button the motor stays at 0 RPM. my objective is to get the motor to move in the positive direction with one button and the negative with the other. I will provide my code as well. // variables
const int forwardPin =8;
const int backwardPin =12;
const int delayTime =1000;
const int but1pin =2;
const int but2pin =3;
int but1;
int but2;
void setup(){
pinMode(forwardPin,OUTPUT);
pinMode(backwardPin,OUTPUT);
pinMode(but1pin,INPUT_PULLUP);
pinMode(but2pin,INPUT_PULLUP);
}
void loop(){
but1= digitalRead(but1pin);
but2= digitalRead(but2pin);
if(but1== HIGH){
digitalWrite(forwardPin,LOW);
}
else{
digitalWrite(forwardPin,HIGH);
}
if(but2== HIGH){
digitalWrite(backwardPin,LOW);
}
else{
digitalWrite(backwardPin,HIGH);
}
}
 I have made sure all my hardware is wired correctly to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!