Skip to content

Commit

Permalink
Add basic RGB leds script support
Browse files Browse the repository at this point in the history
  • Loading branch information
3djc committed Aug 6, 2023
1 parent 5036de3 commit b04c78c
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sdcard/bw128x64/SCRIPTS/RGBLED/blue.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local function init()
end

local function run()
for i=0, LED_STRIP_LENGTH - 1, 1
do
setRGBLedColor(i, 0, 0, 50)
end
applyRGBLedColors()
end

local function background()
-- Called periodically while the Special Function switch is off
end

return { run=run, background=background, init=init }
16 changes: 16 additions & 0 deletions sdcard/bw128x64/SCRIPTS/RGBLED/green.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local function init()
end

local function run()
for i=0, LED_STRIP_LENGTH - 1, 1
do
setRGBLedColor(i, 0, 50, 0)
end
applyRGBLedColors()
end

local function background()
-- Called periodically while the Special Function switch is off
end

return { run=run, background=background, init=init }
16 changes: 16 additions & 0 deletions sdcard/bw128x64/SCRIPTS/RGBLED/off.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local function init()
end

local function run()
for i=0, LED_STRIP_LENGTH - 1, 1
do
setRGBLedColor(i, 0, 0, 0)
end
applyRGBLedColors()
end

local function background()
-- Called periodically while the Special Function switch is off
end

return { run=run, background=background, init=init }
26 changes: 26 additions & 0 deletions sdcard/bw128x64/SCRIPTS/RGBLED/police.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
local function init()
police_oldtime = getTime()
police_cycle = 0
end

local function run()
for i=0, LED_STRIP_LENGTH - 1, 1
do
if (i % 2 == police_cycle) then
setRGBLedColor(i, 0, 0, 50)
else
setRGBLedColor(i, 50, 0, 0)
end
end
if ((getTime() - police_oldtime) > 8) then
police_oldtime = getTime()
police_cycle = 1 - police_cycle
end
applyRGBLedColors()
end

local function background()
-- Called periodically while the Special Function switch is off
end

return { run=run, background=background, init=init }
16 changes: 16 additions & 0 deletions sdcard/bw128x64/SCRIPTS/RGBLED/red.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local function init()
end

local function run()
for i=0, LED_STRIP_LENGTH - 1, 1
do
setRGBLedColor(i, 50, 0, 0)
end
applyRGBLedColors()
end

local function background()
-- Called periodically while the Special Function switch is off
end

return { run=run, background=background, init=init }

0 comments on commit b04c78c

Please sign in to comment.