Skip to content

Update onboard_temperature.c #659

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adc/onboard_temperature/onboard_temperature.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* pico-examples/adc/adc_console/adc_console.c */
float read_onboard_temperature(const char unit) {

/* 12-bit conversion, assume max value == ADC_VREF == 3.3 V */
/* 12-bit conversion, assume max value == ADC_VREF == 3.3 V */4096
Copy link
Contributor

Choose a reason for hiding this comment

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

That looks like a compile error

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, did you mean to put the 4096 inside the comment @ashleey30 ?

const float conversionFactor = 3.3f / (1 << 12);

float adc = (float)adc_read() * conversionFactor;
Expand Down