Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Xyver on July 16, 2011, 08:02:33 PM

Title: Sufficient I/O pins? Please help, need to order parts ASAP!
Post by: Xyver on July 16, 2011, 08:02:33 PM
I'm working on a project, and I need 15 digital input pins (5 RGB LEDS), 6 digital input pins (buttons), and 1 analogue input (microphone).

But, I'm using an Arduino that is running a 328 ATmega chip.  On the Arduino, there are 14 digital I/O pins, and 6 analogue pins.   However, the 328 datasheet says it has 23 programable I/O pins (I need 22).  Can I make the 328 work?
Title: Re: Need more I/O Pins!
Post by: billhowl on July 16, 2011, 09:06:06 PM
You can use the 1 analogue input and this library to control 6 buttons.
Quote
A library to connect more than 1 switch to a single Arduino analgue pin. Can pass a callback function (function pointer) to the constructor AnalogButtons, which gets called when a button event occurs (normal push down or hold down which can be configured for each button separately).
http://arduino.cc/playground/Code/AnalogButtons (http://arduino.cc/playground/Code/AnalogButtons)

The analog input pins can used as digital I/O pins
http://arduino.cc/en/Tutorial/AnalogInputPins (http://arduino.cc/en/Tutorial/AnalogInputPins)
Try not to use digital input pins 0 and 1 as there are used for programming.
Title: Re: Need more I/O Pins!
Post by: Xyver on July 16, 2011, 09:13:40 PM
Yes, but I am just using an Arduino for the prototype.  When using a straight 328, there will be sufficient pins?  And how do you tell the chip which pin is which?  Just in the programming of it?