MCP4725 (DAC) and MPR121 (touch sensor) both are on i2c bus using the Wire lib.
The code below outputs a voltage sweep. If I fly my finger on the mpr121 pads (triggering ISR), it can easily hang the whole thing. Any help appreciated! Thanks!
#include "mpr121.h"
#include <Wire.h>
#include <Adafruit_MCP4725.h>;
Adafruit_MCP4725 dac0;
void setup() {
attachInterrupt(4, readTouchInputs, FALLING);
Wire.begin();
dac0.begin(0x62);
mpr121_setup();
}
void loop() {
for (int i = 1000; i < 4095; i++) {
dac0.setVoltage(i, false);
}
}
void readTouchInputs() {
sei();
Wire.requestFrom(0x5A, 2);
dac0.setVoltage(random(0,4095),false);
}