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?

asked Dec 5, 2014 at 4:13
4
  • forum.arduino.cc/index.php?topic=170470.0 this can be helpful Commented Dec 5, 2014 at 6:16
  • well that's an unanswered question i guess Commented Dec 5, 2014 at 7:55
  • Thats why its in comments i guess Commented Dec 5, 2014 at 7:56
  • Claiming only 2 analog pins must mean that you're using attiny instead of arduino-tiny; I recommend that you use arduino-tiny instead. Commented Dec 5, 2014 at 8:15

2 Answers 2

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).

answered Dec 5, 2014 at 8:14
2
  • well, I mean if I had to declare them as OUTPUT using pinMode(). Should I use digitalWrite() and digitalRead() on them? Commented Dec 5, 2014 at 15:28
  • That's how you use digital I/O with the Arduino libraries, so yes. Commented Dec 5, 2014 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!

answered Dec 5, 2014 at 8:56
1
  • Thanks. I'll read about SPI. I know attinyX5 uses USI, but communication is possible with that library and SoftwareSerial I guess. Commented Dec 5, 2014 at 15:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.