Hi everyone,
I'm new to pd. I built Otem Rellik's piLooper, which runs on a pd patch he created. (do a search on YouTube to see this cool project) It involves a Teensy 3.6 hooked into a Raspberry Pi 4b that has pd installed.
Everything worked properly until I decided to start changing up the hardware. The original piLooper has a 2.2" screen for viewing the loops/tempo/etc.. and a Nintendo DS touchscreen used as a beat repeat/bit crusher on the loops playing back.
I purchased an Adafruit touchscreen to combine both screens. I modified the code to go with the Adafruit libraries and everything appears correct but now pd will give me errors and the piLooper won't work.
I'm not sure what in the code is causing pd to give me errors and I'm not sure where to look in pd to fix it.
piLooper link where pd patch is located
Old code and new code.
//NDS_TOUCH
//limit reads to 5ms
readTime = millis();
touchX = readX();
touchY = readY();
if ((touchX < 900) && (touchY < 900)){
if(readTime - prevReadTime > 16){
Serial.print("Xval: ");
Serial.print(touchX);
Serial.print(" ");
Serial.println(0);
Serial.print("Yval: ");
Serial.print(touchY);
Serial.print(" ");
Serial.println(0);
fxTogOn = 1;
fxTogOff = 0;
prevReadTime = readTime;
}
}else{
if (abs(fxTogOn - fxTogOff) > 0){
Serial.print("postTog: ");
Serial.print(0);
Serial.print(" ");
Serial.println(0);
fxTogOff = fxTogOn;
}
}```
```NEW CODE
//NDS_TOUCH
//limit reads to 5ms
TSPoint p = ts.getPoint();
readTime = millis();
// Assign values to readtouchX and readtouchY
readtouchX = p.x;
readtouchY = p.y;
if ((readtouchX < 900) && (readtouchY < 900)) {
if (readTime - prevReadTime > 16) {
if (p.z > ts.pressureThreshhold) {
Serial.print("X = ");
Serial.print(p.x);
Serial.print("\tY = ");
Serial.print(p.y);
Serial.print("\tPressure = ");
Serial.println(p.z);
fxTogOn = 1;
fxTogOff = 0;
prevReadTime = readTime;
}
} else {
if (abs(fxTogOn - fxTogOff) > 0) {
Serial.print("postTog: ");
Serial.print(0);
Serial.print(" ");
Serial.println(0);
fxTogOff = fxTogOn;
}
}
delay(100);
}```