Skip to content

Commit

Permalink
Add servo example snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
JessamyT committed May 2, 2024
1 parent 7249a87 commit a9ea59f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions components/servo/servo.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ const SubtypeName = "servo"
var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)

// A Servo represents a physical servo connected to a board.
//
// Move example:
// // Move the servo from its origin to the desired angle of 30 degrees.
// myServoComponent.Move(context.Background(), 30, nil)
//
// Position example:
// // Get the current set angle of the servo.
// pos1, err := myServoComponent.Position(context.Background(), nil)
//
// // Move the servo from its origin to the desired angle of 20 degrees.
// myServoComponent.Move(context.Background(), 20, nil)
//
// // Get the current set angle of the servo.
// pos2, err := myServoComponent.Position(context.Background(), nil)
//
// logger.Info("Position 1: ", pos1)
// logger.Info("Position 2: ", pos2)
//
// Stop
// // Move the servo from its origin to the desired angle of 10 degrees.
// myServoComponent.Move(context.Background(), 10, nil)
//
// // Stop the servo. It is assumed that the servo stops moving immediately.
// myServoComponent.Stop(context.Background(), nil)
type Servo interface {
resource.Resource
resource.Actuator
Expand Down

0 comments on commit a9ea59f

Please sign in to comment.