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.
Diff: pwm.cpp
- Revision:
- 1:12f18cede014
- Parent:
- 0:62e51b80d738
- Child:
- 3:c9df852ad9ac
--- a/pwm.cpp Thu Feb 15 13:19:37 2018 +0000 +++ b/pwm.cpp Thu Feb 15 20:17:42 2018 +0000 @@ -1,7 +1,8 @@ //this defines motor setup and movement #include "mbed.h" #include "C12832.h" -#include "pins.cpp" +#include "pins.h" +#include "pwm.h" //will have to determine real pulsewidths by testing with encoder //constants to be utilized in the buggy, can be changed as required #define NORMAL_PWM 0.5f @@ -10,17 +11,16 @@ #define RIGHT_MOTOR_CONST 1 #define LEFT_MOTOR_CONST 1 #define MOTOR_PERIOD 1.0f - //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(1); - motorDirRight.write(1); - motorModeLeft.write(1); - motorModeRight.write(1); + motorDirLeft.write(0); + motorDirRight.write(0); + motorModeLeft.write(0); //1 =bipolar, 0 = unipolar + motorModeRight.write(0); driveBoard.write(1); } void buggyGoF(){ //drives forward