arduino / ArduinoCore-samd

Arduino Core for SAMD21 CPU
GNU Lesser General Public License v2.1
470 stars 718 forks source link

Undefined "ADC_BATTERY" on MKRWAN1310 #487

Closed nikiromagnoli closed 4 years ago

nikiromagnoli commented 4 years ago

Hello everyone,

I believe this should be a simple one. I developed my firmware on MKRWAN1300, now I moved to MKRWAN1310 because of claimed improvements in low-power consumption.

I have a snippet in my firmware that tries to detect battery level using the following

int sensorValue = analogRead(ADC_BATTERY);

Now I moved the board to MKRWAN1310 and compiler says that "ADC_BATTERY" is undefined. Looked in variant.h and actually there isn't any.

Aside: I searched around and found this commit that reports that "ADC pin is not connected" on MKRWAN1310...dunno if this is related but it pinned up my attention.

So how should I test for battery level on MKRWAN1310 as ADC_BATTERY is undefined?

Thank you.

03sarath commented 4 years ago

@TechNyquist you cannot read battery status using ADC_BATTERY because PIN 32 is now connected to SPI FLASH CHIP as FLASH_CS use any Analog Pins to read battery voltage.

nikiromagnoli commented 4 years ago

I see. So a "manual" wiring to a generic Analog Pin is required for this here. Ok, thank you.