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.
Dependencies: ExperimentServer QEI_pmw MotorShield
Diff: main.cpp
- Revision:
- 1:95a7fddd25a9
- Parent:
- 0:43448bf056e8
- Child:
- 4:7a1b35f081bb
--- a/main.cpp Wed Aug 12 11:54:33 2015 +0000
+++ b/main.cpp Thu Sep 10 14:26:20 2015 -0400
@@ -9,7 +9,7 @@
Serial pc(USBTX, USBRX); // USB Serial Terminal
ExperimentServer server; // Object that lets us communicate with MATLAB
-PwmOut motorPMW(D5); // Motor PMW output
+PwmOut motorPWM(D5); // Motor PWM output
DigitalOut motorFwd(D6); // Motor forward enable
DigitalOut motorRev(D7); // Motor backward enable
Timer t; // Timer to measure elapsed time of experiment
@@ -21,8 +21,8 @@
server.attachTerminal(pc);
server.init();
- // PMW period should nominally be a multiple of our control loop
- motorPMW.period_us(500);
+ // PWM period should nominally be a multiple of our control loop
+ motorPWM.period_us(500);
// Continually get input from MATLAB and run experiments
float input_params[NUM_INPUTS];
@@ -38,15 +38,15 @@
encoder.reset();
motorFwd = 1;
motorRev = 0;
- motorPMW.write(0);
+ motorPWM.write(0);
// Run experiment
while( t.read() < 2 ) {
// Perform control loop logic
if (t.read() < 1)
- motorPMW.write(v1);
+ motorPWM.write(v1);
else
- motorPMW.write(v2);
+ motorPWM.write(v2);
// Form output to send to MATLAB
float output_data[NUM_OUTPUTS];
@@ -60,7 +60,7 @@
}
// Cleanup after experiment
server.setExperimentComplete();
- motorPMW.write(0);
+ motorPWM.write(0);
} // end if
} // end while
} // end main
\ No newline at end of file