Given an Arduino Mega with a genuine Arduino motor shield
Motors will be powered at 80 percent voltage
Input pins are 48, 49, 30, 26, 24, 22, 46, 47, 27, 25, 23, 45, 43
Output pins are 4
Motors are initially off
There are three stages:
Stage one starts when pin 45 goes high. Remain in stage one until exit condition is met:
Stage one:
If pin 25 is high, both motors on forward
If pin 27 is high, right motor forward and left motor reverse
If pin 23 is high, left motor forward and right motor reverse
If pin 43 goes high, exit stage one and start stage two
Remain in stage two until exit condition is met
Stage two:
Both motors off for 5 seconds
Both motors reverse for 5 seconds
Right motor forward and left motor reverse for 3 seconds
Stop both motors
If pin 24 is high, both motors on forward
If pin 26 is high, right motor forward and left motor reverse
If pin 22 is high, left motor forward and right motor reverse
If pin 30 goes high, exit stage two and start stage three
Stage three:
Stop motors
Make pin 41 high for one second, then low
Delay 23 seconds
Both motors reverse for 5 seconds
Right motor forward and left motor reverse for 5 seconds
Both motors off
Return to original condition, waiting for pin 45 to go high
Mike Rigsby
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.