![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Code to move the position of the base plate of the turret
Diff: main.cpp
- Revision:
- 0:9c87d309ecac
diff -r 000000000000 -r 9c87d309ecac main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 12 16:33:20 2018 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" +#include "stdio.h" + +PwmOut speed(p26); +DigitalOut fwd(p30); +// p26 connects to IN1 and determines motor speed +// p30 connects to IN2 and determines motor direction +// fwd = 1 gives CW motion, fwd = 0 gives CCW motion + +int run = 1; + +int main() +{ + speed.period(0.008); + + while(run == 1) + { + speed = 0.5; + fwd = 1; + wait(5.0); + + speed = 0; + fwd = 0; + wait(5.0); + + speed = .5; + fwd = 0; + wait(5.0); + + speed = 0; + fwd = 0; + wait(5.0); + + run = 0; + } +}