cancel
Showing results for 
Search instead for 
Did you mean: 

SPWF04 MicroPython Timers

T S
Associate
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
0 REPLIES 0