0

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()

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198

1 Answers1

0

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
Marcel Stör
  • 22,695
  • 19
  • 92
  • 198