Question
I am using proteus software and I have the following source code: i need it to power two dc motors to run clockwise or counter
I am using proteus software and I have the following source code: i need it to power two dc motors to run clockwise or counter clockwise using 4 buttons. Right now the code is running only first motor when pressing each button and not the second motor. I am not sure what I am missing. Please see the code:
#include
int main() { //char button; DDRB = 0xff; //make port B outputs DDRD = 0x00; //make port D inputs PORTD = 0XFF;
// Write your code here while(1) { // button = PIND; if (PIND == 0xFE) { PORTB = 0X05; } else if (PIND==0XFD) { PORTB=0X06; } else if(PIND == 0xFB) { PORTB = 0X05; } else if(PIND==0XF7){ PORTB=0X06;} else { PORTB = 0X00; } }return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started