Skip to content

Conversation

peterharperuk
Copy link
Contributor

This can be used to monitor power usage of a Pico device.

This can be used to monitor power usage of a Pico device.
@peterharperuk
Copy link
Contributor Author

@Louis31423142 As discussed, could you test this and make sure it works? I'll add some wiring diagrams and a readme before submitting. Thanks.

@lurch lurch changed the title eAdd ina260 example Add ina260 example Aug 29, 2025
Comment on lines +32 to +33
gpio_set_function(PICO_DEFAULT_I2C_SDA_PIN, GPIO_FUNC_I2C);
gpio_set_function(PICO_DEFAULT_I2C_SCL_PIN, GPIO_FUNC_I2C);
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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();
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants