sipeed / Maixduino

Arduino port on Maix board ( k210 )
https://maixduino.sipeed.com
Other
213 stars 93 forks source link

Analogue inputs don't work #77

Open technoblogy opened 4 years ago

technoblogy commented 4 years ago

The analogue inputs don't work; trying:

Serial.println(analogRead(A0));

always prints 0, and:

Serial.println(analogRead(33));

always prints 33.

CombiesGit commented 4 years ago

None analog input pin exist!

See wiring.c `uint32_t analogRead( uint32_t ulPin ) {

if (defined(BOARD_SIPEED_MAIX_GO) || defined(BOARD_SIPEED_MAIX_ONE_DOCK) )

return 0;

endif

}`

analogRead() is a dummy function.

technoblogy commented 4 years ago

I'm referring to the Maixduino board. There are six analog pins; see here:

maixduino_pins.png
CombiesGit commented 4 years ago

Ahh,

The analog pins are owned by ESP not by K210.

technoblogy commented 4 years ago

They still need to be supported in the Maixduino core.

barni2000 commented 3 years ago

For use analog pins you will need write SPI code for connection between the ESP32 and k210. Analog pins only works from the ESP.

technoblogy commented 3 years ago

Is there a plan to add the necessary code to the Arduino core, so analogRead() will work as expected?