Rule for led blink

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
qwerty_21
Normal user
Posts: 11
Joined: 24 Apr 2021, 11:54

Rule for led blink

#1 Post by qwerty_21 » 27 Aug 2023, 10:56

Hello everyone,

i`m newbie with esp modules.
I made some "projects" such as temperature readings on cental heating and light switching from node red and mqtt.

My new project is to make temeprature room reading.

I use esp 07, lcd 16x2 i2c, logic converter txs0108e, bme 280 (5V)...
Uploded version of espeasy is: espeasy mega 20181023 dev.

My problem is in want to make alarm if room temperature is exceed 30 degree.
When set temperature is exceeded alarm works but when temerature is below led bliks every 1s.

For better understanding i attached pictures below.


Thanks for your help.
Regards
Sam
Attachments
povezava.png
povezava.png (1.01 MiB) Viewed 966 times
4.jpg
4.jpg (439.72 KiB) Viewed 966 times
3.jpg
3.jpg (347.78 KiB) Viewed 966 times
2.jpg
2.jpg (227.12 KiB) Viewed 966 times
1.jpg
1.jpg (235.41 KiB) Viewed 966 times

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

Re: Rule for led blink

#2 Post by TD-er » 27 Aug 2023, 11:34

I think you can simplify it a bit like this:

Code: Select all

on senzor#Temperature do
  if %eventvalue1% < 30
    GPIO,16,0
    if [int#1] = 0
      // Variable #1 is set to 0, so we need to start the longpulse continously
      let,1,1 // set variable #1 to 1
      longpulse_ms,16,1,500,500,-1 // Continous blinking at 1 Hz (50% dutycycle)
    endif      
  else
    GPIO,16,1
    let,1,0 // set variable #1 to 0
  endif
endon
See the parameters of longpulse: https://espeasy.readthedocs.io/en/lates ... ernal-gpio

User avatar
Ath
Normal user
Posts: 3526
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Rule for led blink

#3 Post by Ath » 27 Aug 2023, 14:50

qwerty_21 wrote: 27 Aug 2023, 10:56 I use esp 07, lcd 16x2 i2c, logic converter txs0108e, bme 280 (5V)...
Uploded version of espeasy is: espeasy mega 20181023 dev.
That is quite an old release of ESPEasy, you'd want to upgrade to a more modern release, download the latest from here: https://github.com/letscontrolit/ESPEasy/releases
/Ton (PayPal.me)

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

Re: Rule for led blink

#4 Post by TD-er » 27 Aug 2023, 15:07

If it is indeed an ESP07 (not ESP07S) then I think it is not possible, as those are 512k flash units.

The longpulse_ms command wasn't present back then. (not sure about the longpulse command either)

qwerty_21
Normal user
Posts: 11
Joined: 24 Apr 2021, 11:54

Re: Rule for led blink

#5 Post by qwerty_21 » 29 Aug 2023, 10:08

Hello everyone,

i think i solve a problem. I upgrade on latest version of espeasy and import rule i attached and it works now.

Thanks for help.

Regards
Sam

User avatar
Ath
Normal user
Posts: 3526
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Rule for led blink

#6 Post by Ath » 29 Aug 2023, 12:00

Great that it's now solved, thanks for the feedback :)
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests