ESP8266 Wemos D1 Mini - Time Input Widget

Pete.

1 Like

2.4.2 works :slight_smile:

I’m going to reduce my code now, the PIR worked in first tests.

2 Likes

Hey PeteKnight

I think it is running now as it should be :slight_smile:
Just one small issue I found out and don’t know why that happens.

An LED effect stops by accident and then some LEDs are still on.
In this case would it be OK to set a variable to true if the LED effect is running, and if time over, set it to false.

Inside of the loop I would check if this variable is false and if so set the LEDs to black (0,0,0).

Or does this belong to your debounce thing you mentioned earlier?

You wouldn’t need to do the check within the loop, you could use a timer instead.

The debounce routine is to prevent problems that occur when mechanical switches don’t make a perfectly clean on/off action. Instead you get lots of very fast on/off events within a few milliseconds when the contacts open and close. The debounce code ignores these very fast on/off events.

Pete.

ah ok, thats not the problem I have with the PIR. It sets the PIN to HIGH and then isn’t responsible to any motion for 2-3 Seconds.

My aim is to extend the time the LEDs will be on, if the motion is still detected after this known “downtime”.

ok pete, first night with all the changes made yesterday… I have an old new problem…

something seems to break the memory or anything else. my esp starts at some to restart. sometimes after the bootup… sometimes after minutes… sometimes it reconnects… sometimes it stays offline.

I think it belongs to the attached interrupt? but I’m not sure.
I know it could be realy hard to troubleshoot this, but where to start?

I retryed with actual board firmware and the ICACHE_RAM_ATTR, but that isn’t the problem.

I don’t understand what this means.

Pete.

The thing you mentioned yesterday. I don’t need the ICACHE thing for the PIN_change void if I use the older firmware 2.4.2.

Because of disconnects I tryed 2.5.2 with ICACHE, but that didn’t help so went back to 2.4.2.

Ok, I think I found the problem. It belongs to the attachedinterrupt :frowning:

If I do it the wrong way you all told me (I just did a try and error session) it runs without disconnect…
PIR is readout inside the loop and if 5 seconds are passed since last PIR = HIGH then the effect is started or checked if it is running and so on.

Ok guys, everything is working fine now.

I have just small cosmetic things to polish.
I have a Labeled Value for just text inside my Blynk app on V19.

That is a headline for my widget below this Value.
I just want to change the color for this widget.

I did this inside the void setup () and inside the BLYNK_WRITE(V19) and it doesn’t work.
Yeah I did the same thing for around 10 other widgets in this app and the color appears there, but not in V19 (I also tryed V40 instead).

How I did it:

BLYNK_WRITE(V19)
{
  Blynk.setProperty(V19, "color", "#33FF3C");
}

or this way:

void setup()
{
...
  Blynk.setProperty(V19, "color", "#33FF3C");
...
}

What am I doing wrong?