Francesco,
Servo.Setup gives a syntax error for all ESP32 versions.
Jan
Servo.Setup
Re: Servo.Setup
Sorry. This is a mistake on my part. Had used some old code.
Replace Servo.Setup with Pwm.Setup and
Replace Servo for Pwm.Out and it will work.
Jan
Replace Servo.Setup with Pwm.Setup and
Replace Servo for Pwm.Out and it will work.
Jan
Re: Servo.Setup
Some additional information about servos
With ESP8266:
Servo id, Value id = servo channel 1-4, Value = angle 0 to 180
Servo.Setup id, pin_number | OFF id = servo channel 1-4, pin_number = 0-16, OFF = disconnect pin PWM output.
With ESP32:
PWM.Out id, Value id = servo channel 1-15, Value depends on PWM.Setup.
PWM.Setup pin, OFF Disconnect pin from PWM output.
PWM.Setup pin, chan, standard, frequency, resolution
PWM Setup 4, 1, 150, 50, 12
PWM.Out id, Value for a 0-180 Servo and PWM.Setup values.
PWM.Out 1, 0%=1mS=205, 25%=285, 50%=1.5mS=365, 75%=445, 100%=2mS=525 (0-180 degrees)
PWM.Out 1, 0%=1mS=205=Clockwise, 50%=1.5mS=365=Stop, 100%=2mS=Left for a 360 degree servo motor and the intermediate values determine the speed.
Jan
With ESP8266:
Servo id, Value id = servo channel 1-4, Value = angle 0 to 180
Servo.Setup id, pin_number | OFF id = servo channel 1-4, pin_number = 0-16, OFF = disconnect pin PWM output.
With ESP32:
PWM.Out id, Value id = servo channel 1-15, Value depends on PWM.Setup.
PWM.Setup pin, OFF Disconnect pin from PWM output.
PWM.Setup pin, chan, standard, frequency, resolution
PWM Setup 4, 1, 150, 50, 12
PWM.Out id, Value for a 0-180 Servo and PWM.Setup values.
PWM.Out 1, 0%=1mS=205, 25%=285, 50%=1.5mS=365, 75%=445, 100%=2mS=525 (0-180 degrees)
PWM.Out 1, 0%=1mS=205=Clockwise, 50%=1.5mS=365=Stop, 100%=2mS=Left for a 360 degree servo motor and the intermediate values determine the speed.
Jan