Code to move the position of the base plate of the turret

Dependencies:   mbed

main.cpp

Committer:
cjedwardz
Date:
2018-02-12
Revision:
0:9c87d309ecac

File content as of revision 0:9c87d309ecac:

#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;
    }
}