1
0
Fork 0
mirror of https://github.com/nealey/puzzle-box.git synced 2025-01-20 13:55:01 -07:00
puzzle-box/build/sketch/pulse.cpp

20 lines
302 B
C++
Raw Normal View History

2020-12-06 18:36:12 -07:00
#include "pulse.h"
#include <Arduino.h>
Pulse::Pulse(unsigned long period) {
this->period = period;
this->nextEventMillis = 0;
}
bool Pulse::Tick() {
unsigned long now = millis();
if (now >= nextEventMillis) {
nextEventMillis = now + period;
return true;
}
return false;
}