Question
Update: The round circles are the 'sensors' or wheels, the buttons are the on/off switches My code isn't running properly - right now i can
Update: The round circles are the 'sensors' or wheels, the buttons are the on/off switches
My code isn't running properly - right now i can only get both motors on, both motors off. Can someone please help with my code? (using proteus)
case 0: // Both sensors are off. // Turn both motors on.
case 1: // Right sensor is on. // Turn right motor on, left motor off.
case 2: // Left sensor is on //Turn left motor on, right motor off.
case 3: //Both sensors are on. Turn both motors off.
my code:
#include #include #include #include #include #ifndef F_CPU # define F_CPU 16000000UL // clock speed is 16MHz #endif
int main() { DDRB = 0xff; DDRD = 0X00;
while (1) { if(PIND & (1
}; // while loop end }
BTN1 BUTTON BTN2 0 BUTTON U1 16 8 U2 10 IN1 VSS IN2 EN1 VS OUT1 OUT2 PDO/RXD/PCINT16 PBO/ICP1/CLKO/ECINTO PD1/TXD/PCINT17 PB1/0C1A/PCINT1 PD2/INTO/PCINT18 PB2/SS/OC1B/PCINT2 PD3/INT1/0C2B/PCINT19 PB3/MOSI/OC2A/PCINT3 PD4/TO/XCK/PCINT20 PB4/MISO/PCINT4 PD5/T1/OCOB/PCINT21 PB5/SCK/PCINT5 PD6/AINO/OCOA/PCINT22 PB6/TOSC1/XTAL 1/PCINT6 PDTIAIN1/PCINT23 PB7/TOSC2/XTAL2/PCINT7 13 14 15 GeoENN 1 5 6 OUT3 IN4 GND GND OUT4 19 AREF AVCC 20 L293D PCOIADCO/PCINTS PC1/ADC1/PCINT9 PCRIADCZ/PCINT10 PC3/ADC3/PCINT11 PC4/ADC4/SDA/PCINT12 PC5/ADC5/SCL/PCINT13 PC6/RESET/PCINT14 ISSN ATMEGA328P BTN1 BUTTON BTN2 0 BUTTON U1 16 8 U2 10 IN1 VSS IN2 EN1 VS OUT1 OUT2 PDO/RXD/PCINT16 PBO/ICP1/CLKO/ECINTO PD1/TXD/PCINT17 PB1/0C1A/PCINT1 PD2/INTO/PCINT18 PB2/SS/OC1B/PCINT2 PD3/INT1/0C2B/PCINT19 PB3/MOSI/OC2A/PCINT3 PD4/TO/XCK/PCINT20 PB4/MISO/PCINT4 PD5/T1/OCOB/PCINT21 PB5/SCK/PCINT5 PD6/AINO/OCOA/PCINT22 PB6/TOSC1/XTAL 1/PCINT6 PDTIAIN1/PCINT23 PB7/TOSC2/XTAL2/PCINT7 13 14 15 GeoENN 1 5 6 OUT3 IN4 GND GND OUT4 19 AREF AVCC 20 L293D PCOIADCO/PCINTS PC1/ADC1/PCINT9 PCRIADCZ/PCINT10 PC3/ADC3/PCINT11 PC4/ADC4/SDA/PCINT12 PC5/ADC5/SCL/PCINT13 PC6/RESET/PCINT14 ISSN ATMEGA328PStep 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