The arduino code sets up the pin that writes to ESC like this:
Code: Select all
#include <Servo.h>
...
ESC.attach(9,1000,2000); // (pin, min pulse width, max pulse width in microseconds)
Code: Select all
potValue = analogRead(A0); // reads the value of the potentiometer (value between 0 and 1023)
potValue = map(potValue, 0, 1023, 0, 180); // scale it to use it with the servo library (value between 0 and 180)
I've got some micropython code that gets me very close, but I'm feeling like those "min pulse width" and "max pulse width" parameters in the Arduino code help smoothing things out.
I'm setting up the pin this way in Micropython:
Code: Select all
p = machine.Pin(14)
pwm_p = machine.PWM(machine.Pin(14), freq=500, duty=0)