Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Pins c16 and c17 cannot read analog in MicroPython #1

Open
kopp opened this issue Jun 2, 2020 · 0 comments
Open

Pins c16 and c17 cannot read analog in MicroPython #1

kopp opened this issue Jun 2, 2020 · 0 comments

Comments

@kopp
Copy link

kopp commented Jun 2, 2020

If using e.g. makecode, it is possible to read analog values from pins c16 and c17, see e.g.

let moisture = 0
basic.forever(() => {
    moisture = pins.analogReadPin(AnalogPin.C16)
    basic.showNumber(moisture)
    control.waitMicros(10000)
})

This does not work in MicroPython, though, as the pins are of type MicroBitDigitalPin (while to read analog they should be of type MicroBitAnalogDigitalPin).

Is it possible to fix this by simply changing the dig_pin to ad_pin in
https://github.com/calliope-mini/calliope-mini-micropython/blob/master/source/microbit/microbitpin.cpp#L64
for pins c16 and c17 or would this break e.g. the UART implementation?

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

No branches or pull requests

1 participant