mirror of https://github.com/arendst/Tasmota.git
Updated Script Cookbook (markdown)
parent
ecae9e48d6
commit
2cb0205d31
|
@ -524,7 +524,108 @@ endif
|
|||
[Back To Top](#top)
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
#### Ledbar Display with WS2812 ledchain
|
||||
used as display for solar house power input/output (+-5000 Watts)
|
||||
|
||||
>D
|
||||
m:array=0 60 ;defines array for 60 led pixels
|
||||
cnt=0
|
||||
val=0
|
||||
ind=0
|
||||
; rgb values for grid
|
||||
colr1=0x050000
|
||||
colr2=0x050100
|
||||
colg1=0x000300
|
||||
colg2=0x020300
|
||||
ledbar=0
|
||||
blue=64
|
||||
pixels=60
|
||||
steps=10
|
||||
div=0
|
||||
tog=0
|
||||
max=5000
|
||||
min=-5000
|
||||
pos=0
|
||||
|
||||
>B
|
||||
div=pixels/steps
|
||||
=#prep
|
||||
ws2812(array)
|
||||
|
||||
; ledbar is set from broker
|
||||
>S
|
||||
if ledbar<min
|
||||
then ledbar=min
|
||||
endif
|
||||
|
||||
if ledbar>max
|
||||
then ledbar=max
|
||||
endif
|
||||
|
||||
pos=(ledbar/max)*(pixels/2)
|
||||
if ledbar>0
|
||||
then
|
||||
pos+=(pixels/2);
|
||||
if pos>pixels-1
|
||||
then pos=pixels
|
||||
endif
|
||||
else
|
||||
pos+=(pixels/2)+1
|
||||
if pos>pixels-1
|
||||
then pos=1
|
||||
endif
|
||||
endif
|
||||
|
||||
if pos<1
|
||||
or pos>pixels
|
||||
then pos=1
|
||||
endif
|
||||
|
||||
=#prep
|
||||
|
||||
if ledbar==0
|
||||
then
|
||||
array[pos]=blue
|
||||
array[pos-1]=blue
|
||||
else
|
||||
array[pos]=blue
|
||||
endif
|
||||
|
||||
; only used if power is off
|
||||
; so lets may be used normally if on
|
||||
if pwr[1]==0
|
||||
then
|
||||
ws2812(array)
|
||||
endif
|
||||
|
||||
|
||||
#prep
|
||||
for cnt 1 pixels 1
|
||||
ind+=1
|
||||
if ind>div
|
||||
then ind=1
|
||||
tog^=1
|
||||
endif
|
||||
|
||||
if cnt<=pixels/2
|
||||
then
|
||||
if tog>0
|
||||
then val=colr1
|
||||
else val=colr2
|
||||
endif
|
||||
else
|
||||
if tog>0
|
||||
then val=colg1
|
||||
else val=colg2
|
||||
endif
|
||||
endif
|
||||
;->print %cnt% %tog%
|
||||
array[cnt]=val
|
||||
next
|
||||
|
||||
>R
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
#### Multiple IR Receiver Synchronization
|
||||
since i own a magic home with ir receiver i made a script to show how it works
|
||||
i have 2 magic home devices that should be synchronized so i send the commands also to a second magic home via websend
|
||||
|
@ -731,4 +832,3 @@ endif
|
|||
[Back To Top](#top)
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue