Hello,
I am using the MPR121 to measure some capacitances. Everything worked fine, but today the MPR121 wont connect anymore. When running the code below it outputs that the MPR121 isnt connected (error inside MPR1.begin()).
I already scanned the device with a I2C Scanner an there it is found. Any suggestions whats the problem?
[table][tr][td][size=14pt][sub]Code:[/sub][/size][hr][/td][/tr][tr][td][size=9pt][tt]#include <Wire.h>
#include "Adafruit_MPR121.h"
Adafruit_MPR121 MPR1 = Adafruit_MPR121color=#000000[/color];
int a,b,c,d,e,f; // gemessene Kapazität
int Ix; // Variable für den Messstrom
int Tx; // Variable für die Messzeit
bool cap = false; // cap auf true für Kapazitätswert, cap auf false für ADC-Wert
void setupcolor=#000000[/color] {
// Verbindung zum PC
Serial.begincolor=#000000[/color];
while color=#000000[/color]{
delaycolor=#000000[/color];
}
Wire.begincolor=#000000[/color];
// Test ob Verbindung zum MPR hergestellt werden konnte.
// Falls nicht Kabel SCL und SDA nochmal raus und rein stecken.
//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
if color=#000000[/color] {
Serial.println("MPR1 not found, check wiring?");
while color=#000000[/color];
}
}
void loopcolor=#000000[/color] {
if color=#000000[/color]{
Ix = MPR1.readRegister8color=#000000[/color];
Tx = MPR1.readRegister8color=#000000[/color]>>4;
a = (Ix*pow(2, Tx-2)*1024) / (MPR1.filteredDatacolor=#000000[/color]* 3.3);
}
else {
a = MPR1.filteredDatacolor=#000000[/color];
b = MPR1.filteredDatacolor=#000000[/color];
c = MPR1.filteredDatacolor=#000000[/color];
d = MPR1.filteredDatacolor=#000000[/color];
e = MPR1.filteredDatacolor=#000000[/color];
f = MPR1.filteredDatacolor=#000000[/color];
}
Serial.printlncolor=#000000[/color];
Serial.printlncolor=#000000[/color];
Serial.printlncolor=#000000[/color];
Serial.printlncolor=#000000[/color];
Serial.printlncolor=#000000[/color];
Serial.printlncolor=#000000[/color];
Serial.printlncolor=#000000[/color];
}[/tt][/size][/td][/tr][/table]