Maixduino icon indicating copy to clipboard operation
Maixduino copied to clipboard

Analogue inputs don't work

Open technoblogy opened this issue 5 years ago • 6 comments

The analogue inputs don't work; trying:

Serial.println(analogRead(A0));

always prints 0, and:

Serial.println(analogRead(33));

always prints 33.

technoblogy avatar Mar 18 '20 15:03 technoblogy

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.

CombiesGit avatar Apr 05 '20 07:04 CombiesGit

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

maixduino_pins.png

technoblogy avatar Apr 05 '20 07:04 technoblogy

Ahh,

The analog pins are owned by ESP not by K210.

CombiesGit avatar Apr 05 '20 09:04 CombiesGit

They still need to be supported in the Maixduino core.

technoblogy avatar Apr 05 '20 10:04 technoblogy

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

barni2000 avatar Jul 29 '20 00:07 barni2000

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

technoblogy avatar Jul 29 '20 11:07 technoblogy