-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOCS-2949: QA board examples #4661
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ import ( | |
// pin, err := myBoard.GPIOPinByName("15") | ||
// | ||
// // Set the pin to high. | ||
// err := pin.Set(context.Background(), "true", nil) | ||
// err = pin.Set(context.Background(), true, nil) | ||
// | ||
// Get example: | ||
// | ||
|
@@ -27,7 +27,7 @@ import ( | |
// pin, err := myBoard.GPIOPinByName("15") | ||
// | ||
// // Get if it is true or false that the state of the pin is high. | ||
// high := pin.Get(context.Background(), nil) | ||
// high, err := pin.Get(context.Background(), nil) | ||
// | ||
// PWM example: | ||
// | ||
|
@@ -37,7 +37,7 @@ import ( | |
// pin, err := myBoard.GPIOPinByName("15") | ||
// | ||
// // Returns the duty cycle. | ||
// duty_cycle := pin.PWM(context.Background(), nil) | ||
// duty_cycle, err := pin.PWM(context.Background(), nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. returns |
||
// | ||
// SetPWM example: | ||
// | ||
|
@@ -47,7 +47,7 @@ import ( | |
// pin, err := myBoard.GPIOPinByName("15") | ||
// | ||
// // Set the duty cycle to .6, meaning that this pin will be in the high state for 60% of the duration of the PWM interval period. | ||
// err := pin.SetPWM(context.Background(), .6, nil) | ||
// err = pin.SetPWM(context.Background(), .6, nil) | ||
// | ||
// PWMFreq example: | ||
// | ||
|
@@ -67,7 +67,7 @@ import ( | |
// pin, err := myBoard.GPIOPinByName("15") | ||
// | ||
// // Set the PWM frequency of this pin to 1600 Hz. | ||
// high := pin.SetPWMFreq(context.Background(), 1600, nil) | ||
// err = pin.SetPWMFreq(context.Background(), 1600, nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also did not know that this changed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it has always returned an error but someone decided to name the error "high" or made a mistake? I just figured this makes more sense for consistency since looking at the interface it seems to return an error. |
||
type GPIOPin interface { | ||
// Set sets the pin to either low or high. | ||
Set(ctx context.Context, high bool, extra map[string]interface{}) error | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did the returns of
pin.Get
change? like why is there an error now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk if it changed or if this was always wrong? But I'm seeing it returning bool, error: https://pkg.go.dev/go.viam.com/[email protected]/components/board#GPIOPin