Forums > MaxMSP

Help with serial object

April 17, 2013 | 5:30 pm

Hey everybody im currently doing a university project and I have to find a way how to control a LED chain from Max Msp via Arduino.

I want to send a list with 4 values from max to arduino over the serial object. The first value which will choose a specific LED and then the three other values sets the colour.

LED Nr R G B

10 0 0 255

My question is "how exactly do I pack together 4 values and send them through the serial object". I have tried a few solutions but it does not seem to work. Can I send four values into (pack 0. 0. 0. 0.) and then connect it to the serial object.. is it that easy? or do I have to use (atoi) to convert the values into ASCII before sending them to (serial a 9600).

I have never used the serial object before so im not sure how to do it!!

hope you can help :)


April 17, 2013 | 7:19 pm

simplest way to do this is to have the arduino listen for serial events.

http://arduino.cc/en/Serial/Available

then just messages thru serial object, maybe not pack messages, unless you want to code the arduino to break serial strings,


April 17, 2013 | 7:24 pm

this link may give you some ideas

http://arduino-er.blogspot.com/2013/03/read-byte-from-serial-port-and-set-pin.html


April 18, 2013 | 12:08 am

I’ve attached a zipped Max patch, Arduino sketch, and schematic that will demonstrate sending RGB values from Max to Arduino to control an RGB LED. Let me know if you have questions.

Attachments:
  1. RGBLED.zip

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