Hello
I am trying to use analogRead() function on a attiny 13a
Bu there's no response
Can any one tell how to use analog read function with attiny 13a
Please read and follow the directions in the "How to use this forum" post.
Technically speaking an ATiny has four ADC-pins, but usually only 3 of them are used (The reset-pin can be referenced as A0, but dropping the voltage below half of the supply voltage will reset the unit) The pin nrs for analogRead() is not identical to that of digitalRead/Write and pinMode. Since pins are in input mode by default, doing
void setup() {
uint16_t val = analogRead(A2);
}
should return a 10-bit value representing a 1023 (or 4 as you like) parts of the VCC as a voltage on pin 3 (PB4)