1
0
mirror of https://github.com/simisimis/blinkmeter.git synced 2025-12-06 08:42:26 +02:00

first commit

This commit is contained in:
Simonas Narbutas
2018-11-28 15:50:45 +01:00
commit 11928fa855
7 changed files with 143 additions and 0 deletions

20
blinkDetector.lua Normal file
View File

@@ -0,0 +1,20 @@
dofile("counter.lua")
BlinkDetector = {
ON_THRESHOLD = 200,
OFF_THRESHOLD = 100,
ON = 1,
OFF = 0,
state = 0
}
function BlinkDetector:isBlinking(value)
if self.state == self.ON and value < self.OFF_THRESHOLD then
self.state = self.OFF
return true
end
if value > self.ON_THRESHOLD then
self.state = self.ON
end
return false
end