Perhaps it is best to start from scratch here so we can eliminate any possible errors. Let’s test only the motor driver code by itself to start. It could be that there are some conflicts with the ESP32.
Very strange behaviour! Using Thonny whichever of programs I import first (your test code or my original code). I get the error. If I import the alternative code after it will run.
It appears that
m1 = motor(pwmPin = 0, dirPin = 1)
throws the error until it is run again in the new code.
Added
try:
m1 = motor(pwmPin = 0, dirPin = 1)
except:
m1 = motor(pwmPin = 0, dirPin = 1)
and it now works !
Thanks Jack. Nothing else connected and I did not set any frequency. See. posts below how I have resolved it. It would be better if this was not necessary.
Chhers