Created
November 15, 2018 02:23
-
-
Save okyeron/3b2a3278a1b02b28f1de32d67f44174d to your computer and use it in GitHub Desktop.
arc and grid test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- grid and arc test | |
--engine.name = 'TestSine' | |
steps = {} | |
aleds = {} | |
position = 1 | |
intensity = 1 | |
local g = grid.connect() | |
local ar = arc.connect() | |
function init() | |
for i=1,16 do | |
table.insert(steps,math.random(8)) | |
end | |
for i=1,4 do | |
table.insert(aleds,math.random(64)) | |
end | |
grid_redraw() | |
ar.all(0) | |
for i=1,4 do | |
for j=1,64 do | |
ar.led(i, j, 10) | |
end | |
end | |
arc_redraw() | |
end | |
function ar.event(n, z, typ) | |
--aleds[n] = math.random(64) | |
print (n) | |
print (z) | |
print (typ) | |
ar.all(0) | |
for i=1,64 do | |
ar.led(n, i, math.floor(i/4)) | |
end | |
arc_redraw() | |
end | |
function arc_redraw() | |
--ar.all(0) | |
ar.refresh() | |
end | |
function g.event(x, y, z) | |
if z == 1 then | |
steps[x] = y | |
grid_redraw() | |
end | |
end | |
function grid_redraw() | |
g.all(0) | |
for i=1,16 do | |
if i==position then intensity = 15 else intensity = 4 end | |
--print (intensity) | |
g.led(i,steps[i],intensity) | |
end | |
g.refresh() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment