arduino / arduino/ArduinoCore-avr

analogRead doesn't allow to read all channels

Open
#181 2 comments 0 reactions 1 assignee Claimed by @cmaglie View on GitHub
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Currently wiring_analog.c only allows to read channel 0 through 7. However, the internal temperature sensor is located on channel 8.

Fix. Change line 69 in wiring_analog.c
From:
ADMUX = (analog_reference << 6) | (pin & 0x07);
To:
ADMUX = (analog_reference << 6) | (pin & 0x0F);

This will allow to read all channels without any drawbacks as far a I can tell.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.