Skip to main content
T S
Visitor II
June 23, 2018
Question

SPWF04 MicroPython Timers

  • June 23, 2018
  • 0 replies
  • 548 views
Posted on June 23, 2018 at 12:59

I am trying to implement/run Timer on SPWF04S. I loaded script (to RAM 2) from example:

import pyb

a=pyb.Timer(2)

a.init(freq=20)

led=pyb.LED(2)     

def toggle(l):                                        

    l.toggle()

a.callback(lambda t:toggle(led))  

I ran it (AT+S.PYTHON=timer.py) and.... all LEDs went out and next after 20 seconds the Wachdog reset the module.

I have no idea, what I am doing wrong.

And what does the parameter: 'lambda t:' mean?

#spwf04sc #micropython #timer
This topic has been closed for replies.