Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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);
}
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions

Question

How could decision automation systems assist consumers?

Answered: 1 week ago