33 lines
401 B
C++
33 lines
401 B
C++
// Version 1
|
|||
|
|
|
||
|
|
#ifndef CustomTimer_H
|
||
|
|
#define CustomTimer_H
|
||
|
|
|
||
|
|
class CustomTimer
|
||
|
|
{
|
||
|
|
int time;
|
||
|
|
boolean start;
|
||
|
|
public: CustomTimer()
|
||
|
|
{
|
||
|
|
start=false;
|
||
|
|
}
|
||
|
|
public: boolean Delay(int delay)
|
||
|
|
{
|
||
|
|
if (!start)
|
||
|
|
{
|
||
|
|
time = millis();
|
||
|
|
start = true;
|
||
|
|
}
|
||
|
|
if (millis() - time >= delay)
|
||
|
|
{
|
||
|
|
start = false;
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|
||
|
|
|