0

Shift registers need 3 digital pins in order to work (data, clock and latch), but Attiny45/85 chips provides 2 digital and 2 analog pins.

Would I use 1 analog pin as digital pin? How?

1

The ATtinyX5 does not have any analog-only pins; all 5 pins are usable as digital I/O (all 6 if you know what you're doing, but if you need to ask how then you're not ready to do so).

| improve this answer | |
  • well, I mean if I had to declare them as OUTPUT using pinMode(). Should I use digitalWrite() and digitalRead() on them? – whitenoisedb Dec 5 '14 at 15:28
  • That's how you use digital I/O with the Arduino libraries, so yes. – Ignacio Vazquez-Abrams Dec 5 '14 at 15:29
0

As Ingnacio has already pointed out, PB0 to PB4 can be used as digital IO ports without problems. It night be a good idea though not to touch PB6, the RESET pin.

Btw, this isn't different from an Arduino, where all so-called analog pins can be used for digital output as well.

If you want to drive shift registers from an ATtiny85 using SPI, you might want to have a look at the tinySPI library written by Jack Christensen. Please note that I haven't used this library personally!

| improve this answer | |
  • Thanks. I'll read about SPI. I know attinyX5 uses USI, but communication is possible with that library and SoftwareSerial I guess. – whitenoisedb Dec 5 '14 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.