/** * * SWITCH.h * Jan Dvorak z Vozerovic - dvorkaman@centrum.cz - dvorkaman.php5.cz */ #ifndef switch_h #define switch_h #include "WProgram.h" /************************************** /** * Declaration of class SWITCH */ class Switch { public: Switch(int pin); //input pin Switch(int pin,int minPressTime); //minimal pressing time to get action - in ms boolean isPressed(); //returns pressed1 / pressed2; + boolean isMomentaryPressed(); // all calculation and setting private: inline void init(); void makeCalculations(); //sets all properties int inputPin; int minTime; long pressTime; //first occurence of state==1 =< millis() boolean firstPress; int state; //actual digitalRead boolean pressed1; //state=1 for minimal ms boolean pressed2; //after state==1 is this for 1 cykle true, then automaticly =0 - momentary switch }; #endif