added small pixel using pulse width input

This commit is contained in:
Redo
2019-05-10 21:06:06 -05:00
parent 5b5231a4b3
commit 1926d21962
2 changed files with 53 additions and 7 deletions

View File

@@ -0,0 +1,13 @@
return function(gate)
if gate.ports[1]:isrising() then
gate.tickStarted = gate:gettick()
elseif gate.ports[1]:isfalling() then
local ticksOn = gate:gettick() - gate.tickStarted
local colorid = ((ticksOn-1) % 8)
local colorname = string.reverse(tobitstring(colorid, 3))
gate:cb(colorname)
end
end