Eimantas Bernotavicius / Mbed 2 deprecated Buggy_Project

Dependencies:   QEI mbed

pwm.cpp

Committer:
Weranest
Date:
2018-02-22
Revision:
4:48d390356fba
Parent:
3:c9df852ad9ac

File content as of revision 4:48d390356fba:

//this defines motor setup and movement
#include "mbed.h"
#include "C12832.h"
#include "pins.h"
#include "pwm.h"
#include "constants.cpp"
//will have to determine real pulsewidths by testing with encoder

//currently the setup uses unipolar mode, hence the need for direction



void motorSetup(){
    motorRight.period_ms(MOTOR_PERIOD);
    motorLeft.period_ms(MOTOR_PERIOD);
    motorDirLeft.write(0);
    motorDirRight.write(0);
    motorModeLeft.write(0); //1 =bipolar, 0 = unipolar
    motorModeRight.write(0); 
    driveBoard.write(1); //enables the buggy to drive
}


void buggyPWM(float pwmLeft, float pwmRight){ //drives forward
    motorRight.write(pwmRight);
    motorLeft.write(pwmLeft);
}