0
votes

I keep getting an error on this line of code, how can I solve this? Thanks in advance

tmr.alarm(0, 250, tmr.ALARM_AUTO, function()

1
Welcome to SO. Please read stackoverflow.com/help/mcve and edit your question - Bussller
Anything else you need besides my answer? - Marcel Stör

1 Answers

0
votes

You are obviously using an outdated example snippet from somewhere. There is no tmr.alarm function in the timer module.

See https://nodemcu.readthedocs.io/en/latest/modules/tmr/ for the current API documentation. There is a alarm() function on a timer object i.e. you first need to create a timer object. The below example is straight from the documentation:

if not tmr.create():alarm(5000, tmr.ALARM_SINGLE, function()
  print("hey there")
end)
then
  print("whoopsie")
end