Last active
November 15, 2018 02:22
-
-
Save okyeron/406ad051b432234d97ded8fb9a1fbde9 to your computer and use it in GitHub Desktop.
norns arc and grid test - dev version
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 | |
-- for arc-dev branch | |
engine.name = 'PolyPerc' | |
steps = {} | |
aleds = {} | |
position = 1 | |
intensity = 1 | |
local g = grid.connect() | |
local ar = arc.connect() | |
function allLeds(z) | |
for i=1,4 do | |
ar.all(i, z) | |
end | |
end | |
function allRefresh() | |
for i=1,4 do | |
ar.refresh(i) | |
end | |
end | |
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() | |
allLeds(1) | |
for i=1,4 do | |
for j=1,64 do | |
-- ar.led(i, j, 5) | |
end | |
end | |
--ar.refresh(1) | |
--ar.refresh(2) | |
--ar.refresh(3) | |
--ar.refresh(4) | |
allRefresh() | |
end | |
function ar.event(n, z, typ) | |
--aleds[n] = math.random(64) | |
--print (n) | |
--print (z) | |
--print (typ) | |
ar.all(n, 1) | |
for i=2,64 do | |
ar.led(n, i, math.floor(i/4)) | |
end | |
arc_redraw(n) | |
end | |
function arc_redraw(n) | |
ar.refresh(n) | |
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