Help with serial object

Apr 17, 2013 at 5:30pm

Help with serial object

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 :)

#67776
Apr 17, 2013 at 7:19pm

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,

#243713
Apr 17, 2013 at 7:24pm
#243714
Apr 18, 2013 at 12:08am

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
#243715

You must be logged in to reply to this topic.