So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By cro
#71369 Greetings,

I have a NodeMCU device that I have been experimenting with. I'm currently writing a small script to scan for Wi-Fi access points. In the process I created a timer with

Code: Select alltmr.create():alarm(3000, tmr.ALARM_AUTO, scan_for_aps)


I fooled around with the unit for a little while longer, cleared out the init.lua file, and restarted it. Imagine my surprise when I found my timer still running! Except, in this case, it was trying to call an undefined function and I was stuck in a panic loop.

It took me a little while to figure out that I needed to erase the flash completely, and that might take a few tries if the timer was kicked off in the middle of the flash--the unit would restart and not overwrite the part of flash where the timer data was stored.

This begs the question--if I create a timer with ALARM_AUTO, and I use the object-oriented interface (because the numbered timers are deprecated), how can I clear the timer after a reset of the ESP8266? What am I missing here? Should there not be a tmr.clear_all function of some kind?