Attiny85 - Reading from ADC

It can be a bit confusing with ATtinys sometimes. :slight_smile:

ATTiny85 has 3 ADCs (Analog to Digital Converters):
ADC1 is on physical pin 7 (see the picture of your post: "Analog Input 1")
ADC2 is on physical pin 3 ("Analog Input 2")
ADC3 is on physical pin 2 ("Analog Input 3")

Whith this statement

int value = analogRead(1);

you read "Analog Input 1" - it is on physical pin 7

Do not get confused by the fact that physical pin 7 can also be used as "digital pin" and you can do this by using a statement like this:

digitalWrite(2, HIGH);

So: same physical pin, different "name" for analog and digital functions. Confusing :slight_smile:

In your sketch you try to read ADC4 ("Analog Input 4") whitch does not exist.

Change the code like this:

int ADC3=3;   // El pin 3 se usa como ADC3. Physical pin 2
int ADC4=2;   // El pin 4 se usa como ADC2. Physical pin 3

Pin mapping may depend on the core you use. But most cores work like described.
I use DrAzzy's core and I highly recommend it: