
final
Dependencies: MatrixMath Matrix ExperimentServer QEI_pmw MotorShield
Revision 6:1faceb53dabe, committed 2020-08-24
- Comitter:
- elijahsj
- Date:
- Mon Aug 24 20:19:13 2020 +0000
- Parent:
- 5:1ab9b2527794
- Child:
- 7:c31f30183ce1
- Commit message:
- Added motorshield ;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FastPWM.lib Mon Aug 24 20:19:13 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/Sissors/code/FastPWM/#08e3f3230b7c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MotorShield.lib Mon Aug 24 20:19:13 2020 +0000 @@ -0,0 +1,1 @@ +MotorShield#f2ede00aed8a
--- 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 +