I am using a Touchscreen and use I2C with an esp32 to read the point that I am touching.
Additionally, I am controlling four, four wire motors. I need Pin 26,27 for a Motor and I need it also for I2C to communicate with the touchscreen as it is hard wired in. Each works separately perfectly, but when I try and end the Wire and move the motor nothing happens and no error is thrown.
Motor is custom class that uses ledc and works when the motor code is above the Wire setup code.
Is there a Register I can reset ? Like how AVR boards have TWCR?
Motor m1 = Motor(26, 27, 1);
Wire.begin(26, 27);
Serial.println("Wire Begin");
int XL = 0;
int XH = 0;
int YL = 0;
int YH = 0;
int data = 0;
Wire.beginTransmission(TOUCH_I2C_ADD);
Wire.write(TOUCH_REG_XH);
Wire.endTransmission();
Wire.requestFrom(TOUCH_I2C_ADD, 1);
if (Wire.available())
{
data = Wire.read();
}
XH = data;
Wire.end();
Serial.println("Wire End");
m1.Move(100, HIGH);
delay(1000);
m1.Move(0, HIGH);
delay(1000);