Modified experiment example for lab 3 of 2.74
Dependencies: ExperimentServer MotorShield QEI_pmw
Diff: main.cpp
- Revision:
- 8:98a83981c238
- Parent:
- 6:1faceb53dabe
- Child:
- 9:97360c92666f
--- a/main.cpp Mon Aug 24 20:20:50 2020 +0000 +++ b/main.cpp Tue Aug 25 23:38:34 2020 +0000 @@ -4,6 +4,7 @@ #include "ExperimentServer.h" #include "QEI.h" #include "MotorShield.h" +#include "HardwareSetup.h" #define NUM_INPUTS 2 #define NUM_OUTPUTS 3 @@ -22,20 +23,22 @@ AnalogIn currentC(PF_13); //MOTOR C CURRENT SENSOR AnalogIn currentD(PA_4); //MOTOR D CURRENT SENSOR -MotorShield motorA(PE_5, PE_6); //MOTOR A PWM -MotorShield motorB(PB_14, PB_15); //MOTOR B PWM -MotorShield motorC(PA_6, PF_9); //MOTOR C PWM -MotorShield motorD(PF_6, PF_7); //MOTOR D PWM - -//deprecate the following -PwmOut motorPWM(D5); // Motor PWM output -DigitalOut motorFwd(D6); // Motor forward enable -DigitalOut motorRev(D7); // Motor backward enable - - +//MotorShield motorA(PE_5, PE_6); //MOTOR A PWM +//MotorShield motorB(PB_14, PB_15); //MOTOR B PWM +//MotorShield motorC(PA_6, PF_9); //MOTOR C PWM +//MotorShield motorD(PF_6, PF_7); //MOTOR D PWM int main (void) { + initHardware(); // Setup PWM + wait_us(100); + + TIM12->CCR2 = 100; + TIM12->CCR1 = 200; + + while(1){ + } + /* // Link the terminal with our server and start it up server.attachTerminal(pc); server.init(); @@ -86,5 +89,6 @@ motorPWM.write(0); } // end if } // end while + */ } // end main