I'm trying to get two capacity sensors to work with an Arduino Uno. I'm using the Adafruit library, with the Sparkfun capacity sensors, which I've understood to be identical to the Adafruit ones, except for a single 3.3V pin, instead of the 3V + Vin pins.
I can get a single sensor to work perfectly, however, I can't get my code to see the second one.
As soon as I connect the ADD(R) pin on my second capacity sensor to anything, neither sensor works. When the ADD(R) pin on the second one is not connected, the first capacity sensor works fine, but the second one doesn't.
I've attached a Fritzing sketch of the setup I have, with the ADD pin connected to 3.3V, which should give the second sensor the 0x5B address. I've also tried connecting it pin to the SDA and SCL, for 0x5C and 0x5D respectively.
My code is below
Code: Select all
#include <Wire.h>
#include "Adafruit_MPR121.h"
Adafruit_MPR121 cap1 = Adafruit_MPR121();
Adafruit_MPR121 cap2 = Adafruit_MPR121();
void setup() {
while (!Serial); // needed to keep leonardo/micro from starting too fast!
Serial.begin(9600);
Serial.println("Adafruit MPR121 Capacitive Touch sensor test");
// Default address is 0x5A, if tied to 3.3V its 0x5B
// If tied to SDA its 0x5C and if SCL then 0x5D
Serial.println( "looking for 0x5A" );
if (!cap1.begin(0x5A)) {
Serial.println("MPR121 0x5A not found, check wiring?");
while (1);
}
Serial.println("MPR121 0x5A found!");
Serial.println( "looking for 0x5B" );
if (!cap2.begin(0x5B)) {
Serial.println("MPR121 0x5B not found, check wiring?");
while (1);
}
Serial.println("MPR121 0x5B found!");
}
void loop() {
Serial.prinln("In loop");
}