#MicroPython Errors on ESP8266 but not Pico board

5 messages · Page 1 of 1 (latest)

sharp wolf
#

I narrowed it down to the timer or the call back blink but not sure what is going on.

from machine import Pin, Timer
from time import sleep
import machine

led = Pin(2, Pin.OUT)
timer = Timer()
toggle=True
led.off()

def blink(timer):
    led.toggle()

timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

MPY: soft reboot
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
TypeError: function takes 1 positional arguments but 0 were given

Only getting this error for the ESP8266 aka NodeMcu Esp-12F board.

No issues on Pico for Pin('LED', Pin.OUT)

The LED on ESP comes on and stays on and then give argument error.

Please advise.
Thanks

barren bramble
#

Find the function that takes a positional argument that you didn't provide

sharp wolf
primal jetty