Go Down

Topic: How to separate analog inputs from Arduino in Max/MSP (Read 1 time) previous topic - next topic


Jun 17, 2019, 02:42 pm Last Edit: Jun 17, 2019, 02:51 pm by kaelh13 Reason: Add attachment
Hello Y'all,

So I'm kind of new to Arduino and Max/MSP and I'm having some issues. Basically, I have two separate piezo sensors that send out date when I tap them.  In Arduino it shows the separate values, but when I use Max I don't know how to separate these values from the serial.


int analogPin = A0;   // potentiometer wiper (middle terminal) connected to analog pin 0
int analogPin1 = A1;  // potentiometer wiper (middle terminal) connected to analog pin 1
                   // outside leads to ground and +5V

int val0 = 0;  // variable to store the value read
int val1 = 0;

void setup() {
Serial.begin(9600);           //  setup serial

void loop() {
val0 = analogRead(analogPin);  // read the input pin
val1 = analogRead(analogPin1);
Serial.println(val0);          // debug value

delay(100);  // delay to avoid overloading the serial port buffer


You need a delimiter (useful search term) to signify which value relates to which sensor.

Typical delimiters are commas or newline characters.

Go Up