microsoft / pxt-maker

MakeCode target for "Maker" boards (beta)
https://maker.makecode.com/
Other
115 stars 80 forks source link

Raspberry Pi Pico RP2040 Analog Read and Write Not Working #370

Open ErinMutchler opened 1 year ago

ErinMutchler commented 1 year ago

When attempting to perform an analogRead or analogWrite, the Raspberry Pi Pico does not seem to work. analogRead returns a value of 0 always and analogWrite does not actually send anything.

ghost commented 1 year ago

I've looked into this and I think it's because Pins 26/27 are set up in makecode as 'Analog' but only as regular Analog Pins would be, not actually set to read through the Pico's ADC hardware.

Alternatively if pins A0 / A1 were included, those could be read as Analog, automatically read through the ADC I believe.

It would be great to getting Analog Inputs working on the Pico in MakeCode - if anyone has the ability to update the files, here's the documentation from Pi:

https://www.raspberrypi.com/documentation/pico-sdk/hardware.html#hardware_adc