Rule based 12 LED NeoPixel Clock

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
happytm
Normal user
Posts: 47
Joined: 15 Aug 2016, 17:53

Rule based 12 LED NeoPixel Clock

#1 Post by happytm » 05 Jul 2019, 23:25

I tried to create 12 led clock using neopixel(basic) and dummy sensor task with quad selected as sensors. I came up with following rules which seems to do the job.I know there must be better way to do it so please correct the rules for better.This demonstrate power of rules engine,plugin system & dummy sensor in ESPEasy. It makes it very fast and easy to make DIY projects without knowing any programming.The hour indicator is red ,minute indicator is flashing blue every 5 seconds which also represent seconds indicator.

on Clock#Time do
timerSet,1,5
TaskValueSet,12,1,%sysmin%/5
TaskValueSet,12,2,[dummy#minutenow]-1
TaskValueSet,12,3,%syshour%
if [dummy#hournow]>12
TaskValueSet,12,3,[dummy#hournow]-12
endif
TaskValueSet,12,4,[dummy#hournow]-1
neopixel,[dummy#hournow],255,0,0
neopixel,[dummy#hourprev],0,0,0
endon

on Rules#timer=1 do
if [dummy#minutenow]=[dummy#hournow]
neopixel,[dummy#minutenow],255,255,255
else
neopixel,[dummy#minutenow],0,0,255
endif
timerSet,2,1
endon

on Rules#timer=2 do
neopixel,[dummy#minutenow],0,0,0
timerSet,1,5
endon

Thanks

happytm
Normal user
Posts: 47
Joined: 15 Aug 2016, 17:53

Re: Rule based 12 LED NeoPixel Clock

#2 Post by happytm » 07 Jul 2019, 01:10

With some minor adjustment :

on Clock#Time do
timerSet,1,5


TaskValueSet,12,1,%sysmin%/5
TaskValueSet,12,2,[dummy#minutenow]-1
TaskValueSet,12,3,%syshour%
if [dummy#hournow]>12
TaskValueSet,12,3,[dummy#hournow]-12
endif
if [dummy#hournow]=0
TaskValueSet,12,3,12
endif
TaskValueSet,12,4,[dummy#hournow]-1

neopixel,[dummy#hournow],55,0,0
neopixel,[dummy#hourprev],0,0,0

endon



on Rules#timer=1 do


if [dummy#minutenow]=[dummy#hournow]
neopixel,[dummy#minutenow],255,255,255

else


neopixel,[dummy#minutenow],0,0,55
endif

if [dummy#minutenow]=0
TaskValueSet,12,1,12

endif

timerSet,2,1

endon

on Rules#timer=2 do

neopixel,[dummy#minutenow],0,0,0
timerSet,1,5

endon

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests