Changing the value of a Pin with the pin method is extremely slow. It takes about 2.5 ms (!) to change the pin output level. A 0/1 burst then has a frequency of 200 Hz.
Other micropython port are in the range of 1-4 µs, 1000 times faster.
Is there any way to speed this slow pace?
Test code:
from machine import Pin
p1 = Pin("D1", Pin.OUT, value=1)
def run():
global p1
p = p1
p.value(0);p.value(1)
p.value(0);p.value(1)
p.value(0);p.value(1)
p.value(0);p.value(1)
p.value(0);p.value(1)
p.value(0);p.value(1)
p.value(0);p.value(1)
p.value(0);p.value(1)
p.value(0);p.value(1)
p.value(0);p.value(1)
run()
Changing the value of a Pin with the pin method is extremely slow. It takes about 2.5 ms (!) to change the pin output level. A 0/1 burst then has a frequency of 200 Hz.
Other micropython port are in the range of 1-4 µs, 1000 times faster.
Is there any way to speed this slow pace?
Test code: