Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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); }