UKHeliBob:
So, if analogRead() returns say 1012, how is that transmitted ?
Previously, when doing a similar thing with potentiometers, when the serial monitor read 1012, that was the value received into Pure Data - I'll be perfectly honest and say I don't understand the mechanics of getting that information between the two, other than having a very basic understanding of a serial port.
I have had a fiddle with the code and managed to split it into the 4 separate data paths but each time I try and add some kind of threshold for each analogRead, it's all errors...
If the sensor reading has to reach a threshold before it triggers a knock!, I think that will resolve the issue of which sensor is being triggered at any given time.
int knockSensor = A0;
int AnalogVal = 0;
int knockSensor2 = A1;
int AnalogVal2 = 0;
int knockSensor3 = A2;
int AnalogVal3 = 0;
int knockSensor4 = A3;
int AnalogVal4 = 0;
void setup() //
{
Serial.begin(115200);
}
void loop ()
{
AnalogVal = analogRead(knockSensor);
AnalogVal2 = analogRead(knockSensor);
AnalogVal3 = analogRead(knockSensor);
AnalogVal4 = analogRead(knockSensor);
Serial.print(AnalogVal);
Serial.print("knock!");
Serial.print(AnalogVal2);
Serial.print("knock!");
Serial.print(AnalogVal3);
Serial.print("knock!");
Serial.print(AnalogVal4);
Serial.print("knock!");
Serial.print("knock!");
Serial.println();
delay(100); //
}