Electronic – arduino – Multiple 4-Digit 7 Segment Displays with Arduino

7segmentdisplayarduinoi2cmicrocontroller

I have 3, 4-Digit 7-Segment Displays from Adafruit, and the included docs/ libraries say I should connect the display to pins A4 & A5. However, I have three of the displays, so I am looking for a way to connect one to pins A1 & A2, another to A2 & A3, and the 3rd to A4 & A5. I've looked through the included docs/libraries, but I can't seem to figure out what to change in my code or the libraries.

Here is the code I use to initalize them:

Adafruit_7segment matrix = Adafruit_7segment();

I'm hoping for a solution in the form of:

    Adafruit_7segment matrix1 = Adafruit_7segment(1); 
    Adafruit_7segment matrix2 = Adafruit_7segment(2);

or something similar.

Best Answer

I see that this has an I2C driver! You shouldn't need to route each display to 2 I/O pins and set up three separate I2C busses. There's a jumper to change the address on the board. Just daisy-chain the SDA and SCL lines (making sure that there's a pull-up resistor somewhere if they're not already on the boards), and talk to each one in your code through its unique address. You might need to edit that function you're calling to pass an address as an argument-- maybe an Arduino user can post good instructions on how to do that.

To be a bit clearer, use the on-board jumper to give each display its own unique I2C address, and edit the function to include an address argument that specifies which display you're talking to.

UPDATE: http://forums.adafruit.com/viewtopic.php?f=47&t=29774

check out the example there. I don't speak C++, so I'm really going to embarrass myself here to try to help you out, but I think somewhere you need

matrix1.begin(0x70);  // Start up the  LCD matrixes
matrix2.begin(0x71);

The hex numbers will change according to how you've hardware-defined your display addresses.