Strobe / flash NeoPixel in Rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Strobe / flash NeoPixel in Rules

#1 Post by Zodiac69 » 15 Aug 2020, 16:37

Hi All

Hope you can assist me here.
I have a rule that monitor a pin, when the pin goes low(0), i switch a spesific NeoPixel on and when the pin goes high(1) i switch the NeoPixel off.
This works, what i am trying to understand is how can i make the NeoPixel "Strobe / Flash" while it is on?

This is the rule i have at the moment:
On Right#State=0 do
NeoPixel,2,255,128,0
endon

On Right#State=1 do
NeoPixel,2,0,0,0
endon

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Strobe / flash NeoPixel in Rules

#2 Post by TD-er » 15 Aug 2020, 19:16

You can have a look at the loopTimerSet commands: https://espeasy.readthedocs.io/en/lates ... oop-timers
I guess the most simple way is to use a variable to keep track of the state of the LED and then in such a loop timer you flip the state of this variable and write it to the NeoPixel LED.

Code: Select all

On Right#State=0 do
  loopTimerSet_ms,1,500
  let,1,0
endon

On Right#State=1 do
  loopTimerSet_ms,1,0
endon

On Rules#Timer=1 do
  if var#1 = 0
      let,1,1
      NeoPixel,2,255,128,0
  else  
      let,1,0
      NeoPixel,2,0,0,0
  endif
endon

whatsupskip
Normal user
Posts: 125
Joined: 28 Feb 2018, 07:40
Location: Melbourne, Australia

Re: Strobe / flash NeoPixel in Rules

#3 Post by whatsupskip » 06 Sep 2020, 01:11

I was looking for a similar solution. I was just thinking if there is a display panel with 8 to 10 NeoPixels then it is going to become complex very quickly.

Thanks for the example.
Friends with kangaroos and some time koala rescuer.

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests