A safe using the mbed, dc motor, solenoid, and more!

Dependencies:   4DGL-uLCD-SE DebounceIn Motordriver PinDetect SDFileSystem mbed-rtos mbed

solenoid.h

Committer:
adamlawrence
Date:
2016-04-29
Revision:
0:6b5c0ae5acc6

File content as of revision 0:6b5c0ae5acc6:

#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;
};