Serial Formatting of Multiple Analog Inputs

Hi everyone -
I've looked through about a dozen forum messages with similar keywords and couldn't quite find what I was looking for, so I hope this new question isn't too much of an intrusion:

I've got potentiometers hooked up to analog inputs A0 through A5. I'd like to use these channels individually in Max/MSP. Is there an example of something like this? I'm not sure if I'm supposed to be formatting the messages differently from the Arduino or reading them differently on the Max end. Maybe neither works and it simply isn't possible - but that wouldn't make much sense.

Any help would be appreciated -thanks in advance.

OK, I give up

What is a Max/MSP ?

UKHeliBob:
OK, I give up

What is a Max/MSP ?

It is a graphics based programming language for the generation and manipulation of sound.

Maybe neither works and it simply isn't possible - but that wouldn't make much sense.

Correct. Yes it is perfectly possible to do this. However you will have to do a bit of work at the Max end to make it work.

Maybe the simplest way is to use MIDI and send the pot readings as a CC MIDI message. But how you handle MIDI will depend on what sort of Arduino you have. Something you have not told us.

Sadly, my understanding is that I can't do it as MIDI. I'm using a Uno, which I believe means there are a whole other set of challenges. It seems like just decoding the Analog Inputs in serial should be a pretty normal "out-of-the-box" feature for Arduino - is this documented somewhere that I'm failing to look?

Sadly, my understanding is that I can't do it as MIDI.

Yes you can.
You can use serial data and run a helper app in your PC to convert this into a MIDI connection. Such an app is called Hairless.

It seems like just decoding the Analog Inputs in serial should be a pretty normal "out-of-the-box" feature for Arduino

Yes you are wrong about that as well.
You can send the reading from an analogue input but how is MAX supposed to know what analogue input it came from. You have to tag the data somehow and then at the MAX detect this tagging and steer it to the right connections.

If MIDI is too complex for you, then this project is beyond you.

If you just want 6 working MIDI potentiometers, you could try this: https://tttapa.github.io/Control-Surface/Doc/Doxygen/d3/d8d/Multiple-Control-Change-Potentiometers_8ino-example.html

[color=#5e6d03]#include[/color] [color=#434f54]<[/color][b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#000000]h[/color][color=#434f54]>[/color] [color=#434f54]// Include the Control Surface library[/color]

[color=#434f54]// Instantiate a Serial MIDI over USB interface to use with Hairless[/color]
[b][color=#d35400]HairlessMIDI_Interface[/color][/b] [color=#00979c]midi[/color][color=#000000];[/color]

[color=#434f54]// Instantiate an array of CCPotentiometer objects[/color]
[b][color=#d35400]CCPotentiometer[/color][/b] [color=#000000]potentiometers[/color][color=#000000][[/color][color=#000000]][/color] [color=#434f54]=[/color] [color=#000000]{[/color]
  [color=#000000]{[/color][color=#000000]A0[/color][color=#434f54],[/color]        [color=#434f54]// Analog pin connected to potentiometer 1[/color]
   [color=#000000]0x10[/color][color=#000000]}[/color][color=#434f54],[/color]     [color=#434f54]// Controller number of the first potentiometer[/color]
  [color=#000000]{[/color][color=#000000]A1[/color][color=#434f54],[/color]        [color=#434f54]// Analog pin connected to potentiometer 2[/color]
   [color=#000000]0x11[/color][color=#000000]}[/color][color=#434f54],[/color]     [color=#434f54]// Controller number of the second potentiometer[/color]
  [color=#000000]{[/color][color=#000000]A2[/color][color=#434f54],[/color] [color=#000000]0x12[/color][color=#000000]}[/color][color=#434f54],[/color] [color=#434f54]// Etc.[/color]
  [color=#000000]{[/color][color=#000000]A3[/color][color=#434f54],[/color] [color=#000000]0x13[/color][color=#000000]}[/color][color=#434f54],[/color]
  [color=#000000]{[/color][color=#000000]A4[/color][color=#434f54],[/color] [color=#000000]0x14[/color][color=#000000]}[/color][color=#434f54],[/color]
  [color=#000000]{[/color][color=#000000]A5[/color][color=#434f54],[/color] [color=#000000]0x15[/color][color=#000000]}[/color][color=#434f54],[/color]
[color=#000000]}[/color][color=#000000];[/color]

[color=#00979c]void[/color] [color=#5e6d03]setup[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color]
  [b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#d35400]begin[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color] [color=#434f54]// Initialize Control Surface[/color]
[color=#000000]}[/color]

[color=#00979c]void[/color] [color=#5e6d03]loop[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color]
  [b][color=#d35400]Control_Surface[/color][/b][color=#434f54].[/color][color=#5e6d03]loop[/color][color=#000000]([/color][color=#000000])[/color][color=#000000];[/color] [color=#434f54]// Update the Control Surface[/color]
[color=#000000]}[/color]

The code above is meant to be used with the Hairless Serial <-> MIDI bridge. You could also use the HIDUINO or USBMidiKlik firmware for the ATmega16U2 of your Uno. In that case, use "USBMIDI_Interface" instead of "HairlessMIDI_Interface".
In an ideal world, you would use an Arduino Leonardo, Micro or Teensy, as they support MIDI over USB natively. (You can get Leonardo or Micro clones from China for $4 if money is an issue.) In that case, you would use the "USBMIDI_Interface" as well.

Pieter

"What am I missing here?"
This code reads all of the serial inputs simultaneously and outputs a continuous stream without apparent indication of the input. I'd like to have different Analog Inputs control different features in a piece of external software.

"You have to tag the data somehow "

OK - I am asking how this is generally done.

Control Surface and Hairless look like great intermediary solutions - thank you for the recommendations, I hadn't heard of either before - but if there's a way to bypass the conversion to MIDI, I think I'd prefer to do that. Since the Uno is only 9600 baud, I feel like I'll order some faster microcontrollers soon to do MIDI work. I'm just curious about the most direct way to parse these serial messages.

My mistake, sorry. New to this all.

https://docs.cycling74.com/max5/tutorials/max-tut/communicationschapter02.html

This pretty much covers it.
Thanks everyone, anyway.

humament:
My mistake, sorry. New to this all.

You are trying to make decisions on incomplete information.

humament:
Max Comm Tutorial 2: Serial Communication

This pretty much covers it.

You sure of that?

It doesn't cover how you get the different pot values into the serial at the Arduino end so that they can be split into different controls at the Max end.

You can use the 5 most significant bits in an int variable to tag a number to each pot reading, this is because the pot only ever gives you a 10bit reading. This then gives you 32 possible tag numbers. Use a different tag value for each pot, add the tag numbers with an inclusive OR operation to your pot reading, after shifting up your tag number 10 places to the left. Then at the Max end sort out the incoming number by stripping this tag number and using it to direct just the reading number to the appropriate signal channel.

This can be done but to my mind is way more complex than using MIDI. But you seem somewhat reluctant to accept advice, always asking for a simpler way. We do know what we are talking about and you appear not to know. Just consider that when making decisions.