I'm new to Arduino and far from an expert with PD, but I'm trying to make a simple piezo drum trigger which seems to be a simple task yet I am struggling a little.
I'm using the "Knock" example sketch with the Serial.println line modified to read "Serial.println(sensorReading);" rather than "Serial.println("Knock!");" .
This seems to work nicely, with values of 0-1023 appearing in the serial monitor. However, when I open PD and open the serial connection (using the comport object) the values in Arduino's serial monitor change to values I don't understand. Below is the serial monitor reading, the "à"s start when I open the serial connection in PD and continue along the same horizontal line each time I hit the piezo, never progressing to the line below.
344
696
283
210
963
250
288
224
1023
107
361
àààà
And it's a similar situation with the unmodified knock sketch
Knock!
Knock!
Knock!
Knock!
Knock!
Knock!
Knock!
Knock!
Knock!
Knock!
Knock!
Knock!
àààààààààààà
I'm using an Arduino Mega 2560, the piezo is connected to pin A0 and GND with a 1MOhm resistor wired in parallel.
Any advice would be greatly appreciated.