added small pixel using pulse width input
This commit is contained in:
13
bricks/outputs/pixel-update.lua
Normal file
13
bricks/outputs/pixel-update.lua
Normal 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
|
||||
Reference in New Issue
Block a user