Thanks for the quick response...
The Pure Data patch I wrote, which previously worked with a couple of pots and photolenses, has 4 'inlets'. Each Piezo should relate to one of these. At the moment, all 4 sensors are being picked up by the first inlet, with the other 3 not giving any signal.
Picture below of that part of the patch, in case my description reads as nonsense...
The array code I experimented with, and is the one currently loaded to the Arduino is as follows:
const int ledPin = 13;
const int knockSensor[4] = { A0, A1, A2, A3 };
const int threshold = 100;
int sensorReading[4] = {0, 0, 0, 0};
int ledState = LOW;
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
}
void loop()
{
int minThres = 0;
int maxThres = 200;
for (int i = 0; i < 4; i++)
{
sensorReading[i] = analogRead(knockSensor[i]);
sensorReading[i] = analogRead(knockSensor[i]);
if (sensorReading[i] >= threshold)
{
ledState = !ledState;
digitalWrite(ledPin, ledState);
Serial.println(sensorReading[i]);
}
}
// delay ()
}
