Forums > MaxMSP

[Help]reading serial data from arduino does not work..

April 24, 2013 | 6:49 pm

I’m trying to let the volume of each wav file controlled by the serial data from arduino, (of three light sensors).
The serial data is read in arduino’s serial monitor, but max does not read the serial data at all.

I attach the arduino cord and max patch.
I’trying to let max read data from analog 1 first, but it does not work. The arduino serial monitor is turned off.
Could you help me figre out the problem..?

Attachments:
  1. 3resistor.ino


Nat
April 24, 2013 | 6:52 pm

did you select the good port, did you set the correct baud rate ?


April 24, 2013 | 7:00 pm

I think I did right about port.. chose port 3… and what is baud rate ?


April 24, 2013 | 11:51 pm

Baud rate refers to the speed at which data is sent & received over the serial connection. In your Arduino sketch it’s usually set in the setup routine with something like "Serial.begin(9600);" (without the quotes). Whatever speed (in this case 9600 baud) you use, it must then be matched in your Max patch as an argument to the serial object: [serial b 9600].

Also, if you are getting the correct value in Arduino serial monitor, you will need to convert ASCII to integers when receiving them in Max, or else send from Arduino as integers rather than ASCII (i.e., using serial.write instead of serial.print).


Viewing 4 posts - 1 through 4 (of 4 total)