Hello Arduino comunity!
I have conected two mpr121 on a micro pro. IRQ, SCL and SDA are conected on the same spot for both of the boards, I change the address of one board conecting the 3.3v to SDA.
The both board seems to work but i just receive response from one.
I hope you guys can help me.
You have two modules but you only look at one IRQ pin?
void loop()
{
// if mpr121 irq goes low, there have been
// changes to the button states, so read the values
if (digitalRead(IRQ_PIN) == LOW)
readButtons();
// this is needed to keep the sequencer
// running. there are other methods for
// start, stop, and pausing the steps
seq.run();
return;
}
Thanks for the quick response, and yes I wanted tho say that I connect the 3.3v to ADDR sorry!!
I connect both of the modules on the same IRQ pin. Is it that the problem? How can I do to define two IRQ pins?
I am newbie in programming, the code is from a adafruit tutorial that i modified...
The code have to many characters for post in that way...
This might be the big problem. You get data for the second module and immediately overwrite it with the data from the first module. You can use a uint32_t variable to hold both sets of data:
// keep track of touched buttons
uint32_t lasttouched = 0;
uint32_t currtouched = 0;
void readButtons()
{
// read current values
currtouched = cap2.touched() & 0x0FFF;
currtouched <<= 12; // Move cap2 data left by 12 bits
currtouched |= cap1.touched() & 0x0FFF; // put the cap1 data in the lower 12 bits