E46B ADC reading incorrectly when others are created in RP2 port · Issue #6833 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

ADC reading incorrectly when others are created in RP2 port #6833

@benevpi

Description

@benevpi

In the below code, whether or not you created ADC3 affects the reading of ADC4. With the line commented out, I get a reading of about 17 degrees. With it there I get a reading of about 80.

import machine
import time

sensor_temp = machine.ADC(4)
blah = machine.ADC(3) # comment or uncomment this line to trigger / untrigger


conversion_factor = 3.3 / 65535

min_temp = 0
max_temp = 30

while True:
    reading = sensor_temp.read_u16() * conversion_factor
    temperature = 27 - (reading - 0.706)/0.001721
    print(temperature)
    time.sleep(0.5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0