jhagberg / ESP8266TimeAlarms

Arduino ESP8266 version 2.4.0 TimeAlarm library, schedule alarms to occur at specific dates/times
http://www.pjrc.com/teensy/td_libs_TimeAlarms.html
18 stars 14 forks source link

Create new alarm without writing it in the code #6

Open Portia-Lin opened 3 years ago

Portia-Lin commented 3 years ago

Hi. I see your library is implementing scheduled alarms. I want to use it to create my own firmware for a smart switch. I'm interested in the option to create, view and delete alarms via the web interface. As in the picture. How can I create a new alarm without writing it directly in the code? How to view existing alarms? Thanks 84083736-952c3380-a9b8-11ea-8e5c-413e5fc112d3.png

Portia-Lin commented 3 years ago

I figured out how to create a new alarm. I should create a function to add a new alarm. But still wondering how to remove and view existing alarms.

hjkoster400d commented 1 year ago

I'm looking to do the same as you did, can you share how you created the dynamic alarms? That would be a great help :D

hjkoster400d commented 1 year ago

For anyone reading this and want to know;) Found it, the lambda capture needs to specify the variables that it needs in the lambda object. I was using [&] which captures all known variables on the stack by reference. But that wasn't enough for me, because by the time the lambda was triggered, the references where lost.

This is where is ended up with image