Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic RGB leds script support #115

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }
Loading