How to make a button object which sends a single letter message to serial port

Osmo Nadir's icon

Hi guys,

I have Arduino Uno with an ultrasonic range finder and a MAX patch for communication between the Uno and Ableton. To adjust the maximum and minimum range I open Arduino and type a single letter "r" or "s" in Arduino Serial Monitor. But using two apps – Arduino and MAX to control one simple device seems a bit too much for me. I want to send messages (like single letters) to the serial port, using only MaxMSP. This would spare me the necessity of opening Arduino every time I want to make some adjustments.

It would be best to have different messages prepared earlier in a form of button objects, so I could send them to serial port just by clicking the buttons. Any ideas?

All best,
Osmo

Osmo Nadir's icon

Anyone?

hz37's icon

I think you would have more success if your question was a little less broad. Right now it's of the "design my entire project" kind, if you ask me. So focus on one thing at a time, and if you get stuck, you can ask here with a code example. Your Uno can send a number over the Serial line like this:

Serial.begin(57600);

// ...

Serial.write(special_number_goes_here);

Max can receive this Serial message via the [serial] object. Be sure it receives at the same baud rate (57600 if you init as above) and connect a @serport attribute menu to the [serial] so you can see if you are receiving from the Arduino. It may not be connected to the default port.

As for buttons and MIDI mapping, please be more specific. You can use Max as an in-between for whatever you want to do. Like, I use Osculator to translate Max to MIDI messages and have Ableton Live listen to MIDI from Osculator. And as for buttons, that's more an Arduino thing the way I read your question. Do you want to connect a bunch of buttons to your Arduino and then use those as MIDI commands? There's a lot of ways to do that. Look for "Monome" etc.

Osmo Nadir's icon

Hi HZ37,

Thank you for your reply. You are right, the topic was too broad. I edited the topic as well as the beginning post and I hope it's more specific now.

By buttons i meant virtual objects in Max MSP, which – when clicked – send out a single message, like "r". I have a monome64, and it would be very practical to map the virtual buttons with it. No idea how to do it yet. I use Max ctlout/ctlin and makenote objects to communicate directly with Ableton.

All best,
Osmo

Osmo Nadir's icon

Any ideas?