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.
Dependents: TestBenchSerenity-proto_F429ZI TestBenchFlow HSPFLOW1 TestBenchFlow1 ... more
Revision 7:3f1d2cdcf49b, committed 2017-09-12
- Comitter:
- dmwahl
- Date:
- Tue Sep 12 16:58:56 2017 +0000
- Parent:
- 6:e8395448fc8b
- Commit message:
- Updated for latest version of mbed-os
Changed in this revision
coil-driver.cpp | Show annotated file Show diff for this revision Revisions of this file |
coil-driver.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r e8395448fc8b -r 3f1d2cdcf49b coil-driver.cpp --- a/coil-driver.cpp Thu Jul 20 20:33:16 2017 +0000 +++ b/coil-driver.cpp Tue Sep 12 16:58:56 2017 +0000 @@ -1,22 +1,25 @@ // Begin sample code /* #include "mbed.h" -#include "rtos.h" #include "coil-driver.h" + // Coil parameters [control pin, spike time (us), hold time period (us), hold time pulse width (us)] -Coil orange(A0, 500, 40, 3); // Valve driven by pin A0, 500us spike time, 25kHz PWM at 7.5% duty cycle +Coil yellow(A0, 200, 40, 3); // Injector -Coil yellow(A1, 5000, 40, 6); // Valve driven by pin A1, 5ms spike time, 25kHz PWM at 15% duty cycle +Coil orange(A1, 5000, 40, 10); // Shutoff valve +DigitalOut fb(A2); // Fast shutoff circuit for injection valve. High when valve is off, low when valve is on. int main() { while (true) { orange.on(); + fb = 0; yellow.on(); - Thread::wait(500); + Thread::wait(1000); orange.off(); yellow.off(); - Thread::wait(500); + fb = 1; + Thread::wait(1000); } } */ @@ -44,6 +47,7 @@ } else { status = 1; } + return status; } void Coil::on()
diff -r e8395448fc8b -r 3f1d2cdcf49b coil-driver.h --- a/coil-driver.h Thu Jul 20 20:33:16 2017 +0000 +++ b/coil-driver.h Tue Sep 12 16:58:56 2017 +0000 @@ -2,7 +2,6 @@ #define COIL_DRIVER_H #include "mbed.h" -#include "rtos.h" // Coil driver class. Applies full power for given "spike" time // and then applies a PWM signal to keep the coil energized at a lower power.