상명대학교, 임베디드시스템

Dependencies:   ESP-call

simple-timer.lua

Committer:
dshin
Date:
2022-05-23
Revision:
0:bd4e93ef863c

File content as of revision 0:bd4e93ef863c:

delayms = 500

LEDpin = 4
LEDstate = 0

gpio.mode(LEDpin,gpio.OUTPUT)

function toggle()
  if (LEDstate) then gpio.write(LEDpin,gpio.LOW)
                else gpio.write(LEDpin,gpio.HIGH)
  end
  LEDstate = not LEDstate
end

mytimer = tmr.create()
mytimer:register(delayms, tmr.ALARM_AUTO, function () toggle() end)
mytimer:start()