Arduino Serial Data to MAX MSP
Hi,
I'm having trouble receiving data from my Arduino to MAX MSP.
At the moment, I have a bluetooth (HC-06) module that receives int's from my android device. The numbers are then pushed into the serial output (as ints) for the Arduino as a stream of integers.
I cannot retrieve the integers in MAX7. I've looked into the documentation and I have been googling for hours - it seems to me that I can only access the digital pins in binary, not printed integers in the serial monitor. If it is possible, can anyone point me in the right direction on how to use the [serial] object properly to retrieve this data? Or any other methods?
Many Thanks!
Ray
In Communications Tutorial 2 there is a description of the output format from the serial object (they can explain it better than me):
"You'll notice that the numbers appearing in the Max window from the "raw" serial output don't seem to make much sense. This is because the Arduino is transmitting its values as ASCII, as if they were typed on a computer. Thus, the number 15 is represented as ASCII value 49 ("1") followed by ASCII value 53 ("5"). Spaces between our three values are represented by the ASCII for a space (32), and each set of three numbers is terminated by a carriage return and a line feed (ASCII 13 followed by 10). To use these values in Max, we need to first group them together and then convert them from ASCII into a human-readable string."
Here is an example of how this looks in Max:
Thanks very much!
It seems I was having trouble setting up the Max patch then, I couldn't receive anything before!. Can I ask why you added [sel 10 13]? It doesn't seem to work properly when I try to set it up, apart from that it seems to be working just fine! Thanks!
You only need this if you create new lines in Arduino serial output with Serial.println(); with the intention of grouping integers for any reason.
Then Max receives a 13 and a 10, and can group integers into lists based on received new line messages.
You also do not really need the zl object, this is only for creating such a group.
But it is nice for grouping messages.