From bab4c89d7b10c3db39c9062f5c7f66f85fc59b2d Mon Sep 17 00:00:00 2001 From: ollo Date: Sat, 18 Jun 2016 19:12:31 +0200 Subject: [PATCH] Added Boot snake --- displayword.lua | 2 +- main.lua | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/displayword.lua b/displayword.lua index fab35a3..e751e79 100644 --- a/displayword.lua +++ b/displayword.lua @@ -123,7 +123,7 @@ function generateLEDs(words, color) else buf= buf .. white:rep(3) end - if (words.sechs == 1) then + if (words.six == 1) then buf= buf .. white:rep(2) buf= buf .. color:rep(5) -- SECHS buf= buf .. white:rep(1) diff --git a/main.lua b/main.lua index a16ef53..d1d63a5 100644 --- a/main.lua +++ b/main.lua @@ -5,6 +5,7 @@ dofile("displayword.lua") timezoneoffset=1 ledPin=4 +-- Color is defined as GREEN, RED, BLUE color=string.char(0,0,250) connect_counter=0 @@ -44,21 +45,23 @@ tmr.alarm(0, 500, 1, function() end end) -tmr.alarm(1, 5000, 1 ,function() +tmr.alarm(1, 15000, 1 ,function() sec, usec = rtctime.get() time = getTime(sec, timezoneoffset) - print("Time : " , sec) print("Local time : " .. time.year .. "-" .. time.month .. "-" .. time.day .. " " .. time.hour .. ":" .. time.minute .. ":" .. time.second) words = display_timestat(time.hour, time.minute) ledBuf = generateLEDs(words, color) -- Write the buffer to the LEDs ws2812.write(ledPin, ledBuf) - - for key,value in pairs(words) do - if (value > 0) then - print(key,value) - end + + -- Used for debugging + if (clockdebug ~= nil) then + for key,value in pairs(words) do + if (value > 0) then + print(key,value) + end + end end end)