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
I ran through this guide quickly with a Pico and was able to import motor from Makerverse_Motor_2ch without an issue. Is it possible that Makerverse_Motor_2ch.py is not uploaded to your Pico or is in a directory where your code cannot see it?
If you are using Thonny, the file structure of your Pico should look something like this, with the Makerverse_Motor_2ch.py code sitting next to your main code or whichever file contains the code you sent above.
Hi Samuel
Thanks for your reply . I have the Makerverse _Motor_2ch.py in the format as you do but it still did not work at the time , but I have not managed to get it running .
Not sure what I did but it is going
cheers
Nick