Documentation
¶
Overview ¶
Package fs90r allows to control a FS90R servo connected on a PWM GPIO pin
Example (Ccw) ¶
err := rpio.Open() if err != nil { os.Exit(1) } defer rpio.Close() servo := fs90r.NewFS90R(18) servo.SetSpeed(50) // Set servo speed to 50% (CCW)
Example (Cw) ¶
err := rpio.Open() if err != nil { os.Exit(1) } defer rpio.Close() servo := fs90r.NewFS90R(18) servo.SetSpeed(-50) // Set servo speed to 50% (CW)
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS90R ¶
type FS90R struct {
// contains filtered or unexported fields
}
FS90R instance
func NewFS90R ¶
NewFS90R creates a new FS90R instance
The pinID specified must be a PWM compatible pin
Example ¶
err := rpio.Open() if err != nil { os.Exit(1) } defer rpio.Close() servo := fs90r.NewFS90R(18) servo.SetSpeed(100) // Set servo speed to 100% (CCW)
func (*FS90R) SetBalancePoint ¶
SetBalancePoint set the balance point (pulse duration) at which the servo will stay still. The balance point is in milliseconds and is 1.5 by default
You can use this method if the servo is moving at default position (0% speed) but it's better to adjust this value by using the small screw under the FS90R
You can check servos PWM behavior for more details https://www.pololu.com/blog/17/servo-control-interface-in-detail
Example ¶
err := rpio.Open() if err != nil { os.Exit(1) } defer rpio.Close() servo := fs90r.NewFS90R(18) servo.SetSpeed(0) // if the servo is moving with this setup you can use SetBalancePoint servo.SetBalancePoint(1.6) // if the value used in SetBalancePoint is correct, the servo should now stay still
Click to show internal directories.
Click to hide internal directories.