A library for controlling servo motor in M5Stack.
This library has been tested on the M5Stack Gray.
Download this library from the repository as ZIP, and place in ~/Documents/Arduino/libraries/
.
Connect 5V and GND, and connect the signal wire to GPIO 5.
Include this library, and open sample sketch.
Write the sketch to M5Stack, then the servo motor should work!
A constructor that initializes the ledc configuration.
ledc_channel
: Number of Channel to use.pwm_min_width
: Minimum duty ratio of the control pluse of servo motor. default is 500[us]pwm_max_width
: Maximum duty ratio of the control pluse of servo motor. default is 2400[us]ledc_freq
: PWM freqency. default is 50.0ledc_timer_bit
: Number of full scale bits for duty indication. default is 16
A function to assign a pin to the PWM channel.
output_pin
: Number of GPIO to use.
A function to write signals to the servo motor.
value
: the value to write to the servo motor, from 0 to 180
A function to write signals to the servo motor in microseconds.
value
: the value to write to the servo motor in microseconds.
A function to detach the pin from the PWM channel.