-
Notifications
You must be signed in to change notification settings - Fork 949
Add ina260 example #703
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
base: develop
Are you sure you want to change the base?
Add ina260 example #703
Conversation
This can be used to monitor power usage of a Pico device.
@Louis31423142 As discussed, could you test this and make sure it works? I'll add some wiring diagrams and a readme before submitting. Thanks. |
gpio_set_function(PICO_DEFAULT_I2C_SDA_PIN, GPIO_FUNC_I2C); | ||
gpio_set_function(PICO_DEFAULT_I2C_SCL_PIN, GPIO_FUNC_I2C); |
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.
Would be nice (for completeness) if this did the bi_pins thing 🙂
uint16_t mw = read_reg(POWER_REGISTER) * 10; | ||
|
||
// Display results | ||
printf("current: %.2f mA voltage: %.2f v power: %u mW\n", ma, v, mw); |
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.
printf("current: %.2f mA voltage: %.2f v power: %u mW\n", ma, v, mw); | |
printf("current: %.2f mA voltage: %.2f V power: %u mW\n", ma, v, mw); |
} | ||
|
||
int main() { | ||
setup_default_uart(); |
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.
Should this be using stdio rather than explicitly using uart, so that the printf
output can instead be sent to USB by adding the necessary commands to CMakeLists.txt
?
This can be used to monitor power usage of a Pico device.