A safe using the mbed, dc motor, solenoid, and more!
Dependencies: 4DGL-uLCD-SE DebounceIn Motordriver PinDetect SDFileSystem mbed-rtos mbed
Diff: solenoid.h
- Revision:
- 0:6b5c0ae5acc6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/solenoid.h Fri Apr 29 20:01:29 2016 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +//Solenoid Hello World +//Non blocking with auto off and min off-time delay using timer interrupt and timer setup by class +class Solenoid +{ +public: + Solenoid (PinName pin, float ondelay=0.5, float offdelay=2.0); + void write(bool state); + Solenoid& operator= (bool value); + +private: + void Solenoid_Off_Int(); + DigitalOut _pin; + Timeout tint; + Timer offtimer; + float ontime; + float offtime; +}; \ No newline at end of file