Analog input issue with ATTiny841

Hello everyone, I'm currently working on an application using a ATTiny841 (with ATTiny Core 1.1.1) which need an analog voltage measurement. I previously succeeded it on an Arduino Nano using a simple analogRead(vSensePin = 7) after a pinMode(vSensePin, INPUT) in setup() but it don't work with the ATTiny841. The analogRead always return 0.

I expect to an issue with the analog voltage reference, does it use Vcc as default ? But not sure.

I try to measure the voltage of a li-ion cell, up to ~4.2V and a 5V range would be good ! If somebody has an example, I'm very interested in !

Xavier

After another test replacing 7 by A3 it works !

That's correct - you need to use the A number, or the number of the ADC channel (so analogRead(3), for example)- glad you got it sorted.