Drive a coil (valve, solenoid, contactor, etc)
Dependents: TestBenchSerenity-proto_F429ZI TestBenchFlow HSPFLOW1 TestBenchFlow1 ... more
coil-driver.h
- Committer:
- dmwahl
- Date:
- 2017-09-12
- Revision:
- 7:3f1d2cdcf49b
- Parent:
- 6:e8395448fc8b
File content as of revision 7:3f1d2cdcf49b:
#ifndef COIL_DRIVER_H #define COIL_DRIVER_H #include "mbed.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. class Coil { public: Coil(PinName _controlPin, uint16_t _spikeus, uint16_t _holdperiod_us, uint16_t _holdpulse_us); //InterruptIn controlIn; // Input for external coil "ON" signal PwmOut controlOut; // PWM output pin driving coil uint16_t spikeus, holdperiod_us, holdpulse_us, pwmFrequency; char status(); // Return 1 if coil is energized, 0 if not void on(); void off(); }; #endif