Please see the bc_servo functions in the BigClown SDK.

First initialize the servo output by calling function

bc_servo_init (bc_servo_t *self, bc_pwm_channel_t channel)

The channel parameter can be one of the output pins. Please check the Core Module pinout to see which pins allows PWM.

BC_PWM_P0
BC_PWM_P1  // Power Module LED connector
BC_PWM_P2
BC_PWM_P3
BC_PWM_P6
BC_PWM_P7
BC_PWM_P8
BC_PWM_P12
BC_PWM_P14

Then you can control the servo signal and the servo movement. You can use function to set the pulse length in microseconds or you can write directly the desired angle between the 0-180 degrees.

bc_servo_set_microseconds (bc_servo_t *self, uint16_t us)
bc_servo_get_angle (bc_servo_t *self)

In case you need to tune the pulse length limits. Use bc_servo_set_pulse_limits() function.

Example code

bc_servo_t servo;

void application_init()
{
    bc_servo_init(&servo, BC_PWM_P0);
    bc_servo_set_microseconds(&servo, 1500);
}

Example project

Chapters in this document:
Edit this page

We will inspire you!

You will get regularly our Clownsletter with real projects from other Makers. Do not miss it!

By sign up you will know how even you can inspire others and get €100 discount coupon!