Hi,
Im building an Arduino (Uno) based Robot Platform and im running out of pins on my Arduino.
Looking back I should of got a Mega, but i didn't think id run out of pins.
As my Motor Shield uses A0, A1 for current sensing,
I also have 2 Pots hooked up to A2, A3, and a few I2C Devices aswell (A4, A5).
I want to add a Parallax Ping sensor but ive got no analog Inputs left.
But ive got 5 Spare Digital Pins.
I know you can use analog pins as digital pins aswell. (D14, D15, D16, D17, D18, D19)
But can you do the same with Digital pins as Analog Inputs?
Or you could ditch the pots and use rotary encoders instead - although the inexpensive rotary encoders only tell you how much they have moved, instead of telling your their absolute position like a pot does.
No, a standard quadrature rotary encoder uses 2 digital inputs. When using several of them, you can use multiplexing to reduce the total number of pins you need.
Yes but they are continuous rotation, there is no end stop. Normally when you use them in this situation you have some form of level indicator like a display.
For about $20 you could build yourself a ATMega1284 duemilanove style board.
32 IO pins, 16K SRAM, 128K FLASH PROM, 4K EEPROM, 2 hardware UARTs.
I have bare boards for $4.50 (see my signature link), you supply the parts, designed to be easily assembled. Can be all new, or use what you have on hand.
core files from maniacbug are downloaded from here
Another option: add an 8-channel SPI controlled ADC chip to your design.
Control it with the 4 SPI pins (SCK, MOSI, MISO, SS), obtain higher resolution results, and free up your digital IO pins.
Grumpy_Mike:
Yes but they are continuous rotation, there is no end stop. Normally when you use them in this situation you have some form of level indicator like a display.
I am just going to use Normal Pots on the Platform, But i will use a Rotary Enoder For scrolling through an LCD (that displays sensor data from the robot) on my controller.
For the LCD scrolling it doesent have to be acurate it just has to move it up the pages and down using a for loop.
Or i could Just use a rotary switch and a for loop.