2.74 Nucleo Code
Dependencies: ExperimentServer QEI_pmw MotorShield
Diff: main.cpp
- Revision:
- 6:1faceb53dabe
- Parent:
- 5:1ab9b2527794
- Child:
- 8:98a83981c238
diff -r 1ab9b2527794 -r 1faceb53dabe main.cpp --- a/main.cpp Fri Aug 21 22:13:19 2020 +0000 +++ b/main.cpp Mon Aug 24 20:19:13 2020 +0000 @@ -3,6 +3,7 @@ #include "EthernetInterface.h" #include "ExperimentServer.h" #include "QEI.h" +#include "MotorShield.h" #define NUM_INPUTS 2 #define NUM_OUTPUTS 3 @@ -16,10 +17,23 @@ QEI encoderC(PC_6, PC_7, NC, 1200, QEI::X4_ENCODING); // MOTOR C ENCODER (no index, 1200 counts/rev, Quadrature encoding) QEI encoderD(PD_12, PD_13, NC, 1200, QEI::X4_ENCODING);// MOTOR D ENCODER (no index, 1200 counts/rev, Quadrature encoding) +AnalogIn currentA(PF_12); //MOTOR A CURRENT SENSOR +AnalogIn currentB(PF_11); //MOTOR B CURRENT SENSOR +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 + + int main (void) { // Link the terminal with our server and start it up @@ -72,4 +86,5 @@ motorPWM.write(0); } // end if } // end while -} // end main \ No newline at end of file +} // end main +