Quote from: bibletech55 on April 07, 2025, 08:02:17 PMHi there!ADC_BATTERY is not a SAMD21 hardware feature but a board variant alias. MKR boards define ADC_BATTERY in their variant so analogRead(ADC_BATTERY) works. TinyZero's variant does not expose ADC_BATTERY so the symbol is undefined. Fix it by checking the TinyZero schematic to find the ADC pin used for battery sense and then use analogRead(thatPin) or add a simple resistor divider to a free analog pin and read that. See MKR variant examples and TinyZero docs for the pin/schematic references.
I have a TinyZero connected to a small LiPo battery. I would like to read the current capacity of the battery to the Serial Monitor. Since the board is based off of the Arduino Zero (and by extension, the MKR Zero), I sought to read the value of ADC_BATTERY and convert this value to my voltage reading. The following tutorial shows how to measure battery voltage using an MKR Zero. (https://projecthub.arduino.cc/Arduino_Genuino/mkr-zero-read-battery-voltage-e31f42)
Sprunki Game
When verifying the code for the TinyZero, I receive an error that tells me that ADC_BATTERY is not defined in this scope. However, if I verify the exact same code for an MKR Zero, I receive no compilation errors. Since they use the same processor (SAMD21), wouldn't both boards have an ADC_BATTERY pin, and potentially be able to use ADC_BATTERY the same way?
Thank you for any help!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages1
#1
TinyDuino Processors & TinyShields / Re: How to Measure TinyZero Battery Percent?
September 17, 2025, 02:01:32 AMPages1
SMF spam blocked by CleanTalk