How do I use AD4-AD7 on an Arduino Mini?

I'm playing around with an Arduino Mini, and I'd like to use the additional analog inputs AD4, AD5, AD6 and AD7.  I tried initializing them as inputs and outputs using pinMode and writing to the outputs using digitalWrite, but nothing seems to happen.  Is there something more I need to do?

Thanks - I'm somewhat new to Arduino and still a programming n00b.


OK, I repaired my board such that AD4 and AD5 are outputs, and AD6 and AD7 are analog inputs. AD4 and AD5 seem to be working fine now.

More trouble with the AD6 and AD7, though. I'd like to see what value these ADCs are producing, so I used serial.println() to send the value back to the computer. However, when I run this line of code, it causes the Arduino to hang. What's going on here?  serial.println() works fine for sending back text and other variables, why is it having trouble here?

jeff-o (author) 6 years ago
Well, I solved it myself. It turns out that AD6 and AD7 are addressed on pins 22 and 23, NOT 20 and 21. I discovered this purely by accident. Quite a stroke of serendipity, actually. So there you go. 22 and 23.
maewert6 years ago
I have no direct experience using the ArduinoMini, but I did want to point out a few blurbs from www.arduino.cc/en/Guide/ArduinoMini: ------------------------------------------------------------------------- Information about the Arduino Mini The microcontroller (an ATmega168) on the Arduino Mini is a physically smaller version of the chip on the USB Arduino boards, with the following small difference: There are two extra analog inputs on the Mini (8 total). Four of these, however, are not connected to the legs that come on the Arduino Mini, requiring you to solder wires to their holes to use them. Two of these unconnected pins are also used by the Wire library (I2C), meaning that its use will require soldering as well. ----------------------------------------------------------- I assume that you soldered pins into the empty holes for these signals :-) and that you properly selected 'ArduinoMini' as the target hardware in the development environmenet. This should make these pins accessable to the software. Good Luck, Mark
jeff-o (author)  maewert6 years ago
Thanks for the reply. The mini isn't really much different from the regular one, aside from the extra ADC pins. I've got two of the ADCs working fine, the other two I'm unsure about...
jeff-o (author) 6 years ago
Well I think I may have figured out one of my issues... AD6 and AD7 on the Arduino Mini are input-only ADC channels. I was trying to use one of them as an output! I'll fix my circuit and reply again if it worked...