Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

servo.h

Joseph Ryan edited this page Aug 19, 2017 · 3 revisions

Go to the source code for servo.h

Includes

  • #include "gpio.h"
  • #include "pwm.h"

Functions

Function Documention


InitializeServo

Initializes a servo on a pin

tServo *InitializeServo(tPin pin);

Parameters:

  • pin Pin plugged into a servo

Returns:

  • Pointer to an initialized tServo, can be used by the SetServo function

SetServo

Sets a servo to a specified position

void SetServo(tServo *servo, float value);

Parameters:

  • servo Pointer to an initialized tServo, returned by InitializeServo
  • value Float on range [0,1] representing the desired position of the servo

Notes:

  • Servo output is 50hz with 2.5% to 12.5% duty cycle, centered at 7.5%. This function sets a servo value, with 0.0 being 2.5% and 1.0 being 12.5%

Clone this wiki locally