Go Down

Topic: ATtiny 45 analogue pins as digital (Read 5223 times) previous topic - next topic

buycris

Hello,

I have read that if you require more digital pins on the UNO-Using the ATmega328 you can just call analogue pin 0, 14. As this thread reads:

Quote
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1293973123


Im programming the ATtiny45 using Arduino as ISP as this site explains and I'll refer to the pinout for tiny shown here:

Quote
http://hlt.media.mit.edu/?p=1229


For my project I require pin 7 (analogue 1) to be digital but I'm having trouble applying the same philosophy. Anyone have any thoughts on how I can set this pin to be digital?

Thanks


Erni


You can use PIN2 like any other PIN , just use digitalWrite(); fx:

pinMode(2, OUTPUT);   
digitalWrite(2,HIGH);

Flame-Soulis

I have something similar on an ATTiny85. I assume the pinouts are the same and the only difference are the flash sizes.

To make use of the analogue pins as digital, just start with the two digital ones (0 and 1) and start on the first analogue pin (A1 = 2, A2 = 3, A3 = 4). As Erni pointed out, controlling PIN 7, which is Analogue 1, would be digital pin 2. I've heard of ways to make use of the reset pin as another viable i/o, but I have no experience goofing with it.

Best of luck!

-Flame

KirAsh4

If I'm not mistaken, in order to use the reset pin as an i/o pin, you must disable the reset function in the AVR itself.

Erni


You can disable the reset pin to get one more IO pin, but it will be the last time you can program it.
If you want to upload a new program, you cant because yuo don't have a reset pin !!!

You can only get it back by using a HV (High voltage) programmer like this one fx:

http://home.ict.nl/~fredkrom/pe0fko/Fuse-restore-ATtiny45/

lineman2208

Will the same work with an ATtiny85?

mrburnette



You can disable the reset pin to get one more IO pin, but it will be the last time you can program it.
If you want to upload a new program, you cant because yuo don't have a reset pin !!!

You can only get it back by using a HV (High voltage) programmer like this one fx:

http://home.ict.nl/~fredkrom/pe0fko/Fuse-restore-ATtiny45/


Yep.
This is how the Digispark (tiny85-based) works.
Trinket does not reuse the reset, so 1 less PWM

Ray

Trinket clone: http://www.hackster.io/rayburne/chachka-trinket-attiny85-clone
Trinket to Digispark conversion: http://www.hackster.io/rayburne/trinket-firmware-exorcism
Many Digispark libraries work unchanged on Trinket.

Go Up