MAX msp 7: Passing data from MAX to Arduino

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

ความคิดเห็น • 38

  • @benjaminpalevsky8831
    @benjaminpalevsky8831 9 ปีที่แล้ว +2

    Been looking for an accessible explanation of serial communication between Max and Arduino for the longest time.
    Thank you for your hard work ! :)

    • @Programmingforpeople
      @Programmingforpeople  9 ปีที่แล้ว +1

      +Benjamin Palevsky Thanks for the kind words! Glad it helped!

  • @lii3540
    @lii3540 8 ปีที่แล้ว

    Hopefully you can do this series tutorial. Thanks for your sharing. These tutorials are really awesome.

  • @cry0n559
    @cry0n559 7 ปีที่แล้ว

    Just awesome! Saved my life

  • @gantzgraf6853
    @gantzgraf6853 8 ปีที่แล้ว

    Hi, thank you for your videos. They are a great experience and im looking forward to see more of them. But unfortunately i have the same troubles like Benjamin Palevsky. I tried to open the programs in the way you have written. Pleas let me know if you have any sugestions. Thanks a lot!

  • @gorgigeorgie4594
    @gorgigeorgie4594 3 ปีที่แล้ว

    thanks a lot for this! I really don't know how you open serial port in arduino while max msp is running... "Port busy" for me.. do you have an idea how to fix this ?

  • @jacopofoschi3644
    @jacopofoschi3644 2 ปีที่แล้ว

    i tried your method to send srial data using "pak" object, and the 4 "serial.read()" in succession . but it doesn't work for me. how can it work for you ?

  • @supersoicwalrus
    @supersoicwalrus 7 ปีที่แล้ว

    Great video! Is it possible for max to both receive and send serial data concurrently? I've got serial data coming into max (see you previous video), and then would like to send it out using this method. Thanks a lot!

  • @daveklebt7732
    @daveklebt7732 7 ปีที่แล้ว

    very good

  • @aaron_phillips
    @aaron_phillips 3 ปีที่แล้ว

    How would you go about controlling multiple variables on the arduino using Max?
    I'm working on a controller that would have certain LEDs light up based on what the max patch is doing.

    • @gorgigeorgie4594
      @gorgigeorgie4594 3 ปีที่แล้ว

      hi, please, did you manage to do this finally? I was about to ask the same question

    • @aaron_phillips
      @aaron_phillips 3 ปีที่แล้ว

      @@gorgigeorgie4594 Unfortunately my schedule ended up getting very busy and I never made any progress. :/ Definitely still planning to work on it, but I don't have a timeframe.

  • @perryamos7659
    @perryamos7659 7 ปีที่แล้ว

    hey how can you get a print button with an outlet? Mine only has an inlet

  • @adrianadesplansferres4114
    @adrianadesplansferres4114 8 ปีที่แล้ว

    hi, it is possible to download the code anywhere both max and arduino?? thnx

  • @ddomenic
    @ddomenic 8 ปีที่แล้ว

    Hi Michael, I really love your videos! I have a question related to the last part of your videos, sending RGB data from Max to Arduino. I have 5 LED RGB strips attached to 15 PWM pins of a MEGA, and trying to control each of them from Max simultaneously. Can I just use PAK with 15 "0"s as arguments, with values from 0-255 coming into the inputs?. Do I need to convert these to ASCII or append some kind of space/comma at the end of the 15 number set, and how does the Arduino code recognise when the 15 numbers come in...
    sorry if thats vague haha

    • @ddomenic
      @ddomenic 8 ปีที่แล้ว +1

      +Dom Svejkar perhaps an easier question would be, at 7:25 in your video, how would I go about writing Arduino code to transfer the 'pak'ked RGB numbers for 5 Lights (i.e. 15 numbers) via serial...

    • @Programmingforpeople
      @Programmingforpeople  8 ปีที่แล้ว

      +Dom Svejkar thanks for the kind words Dom.
      Sorry, Ive been travelling a crazy amount lately and haven't been able to sit down for this. Ill either send you an image, or a little video of what I would do. You sound like you're on the right path though!
      The r g b values for each light (eg the 15 values) sent as a single message, have arduino read the values separated by a space. I think serial.read in arduino should automatically handle this by default but we might need to string.split the value of not.... Give me a few hours :)

    • @drismusic
      @drismusic 8 ปีที่แล้ว

      I would benefit from seeing / reading how you solved this if it could be made available.

  • @diegocano52
    @diegocano52 7 ปีที่แล้ว

    Great video!
    Is it possible work with more than one output in Arduino?
    I've seen some tutorials and blogs of the explanation, but all is about one output.
    Think on Arduino Mega, it have to many outputs.
    I undestand the "Serial (letter) 9600" send information just by one output, but if I would work with 4 servos, what can I do?
    I need to use 4 arduinos?
    Thakns a lot!

    • @Programmingforpeople
      @Programmingforpeople  7 ปีที่แล้ว

      No not at all!
      The last few minutes of this video talk specifically about sending multiple numbers at a time and passing them into different variables in arduino! Check out 6:20 onwards and let me know.
      You basically 'pak' the items in max and then read them as individual items on the serial port in arduino

    • @diegocano52
      @diegocano52 7 ปีที่แล้ว

      Ooh! I can see! :O
      Very thanks!!!
      :D

    • @dancoffeyuk
      @dancoffeyuk 4 ปีที่แล้ว

      @@Programmingforpeople hello, thanks for this very helpful video. I have control over a single LED on the Arduino no problem (using a toggle in Max) but am really struggling controlling a second from Max. I have studied the bit at the end of your video and can get the data out of Max no problem but am baffled as to how to interpret it within the Arduino code. I assumed I would have to write something in there with parse, no?

  • @shaysilver
    @shaysilver 8 ปีที่แล้ว

    Hi Michael, Fantastic tutorials! thank you very much!!!
    I'm trying to communicate both ways at the same patch... still no success... I know you have 2 videos separated, I hope you will make another one that shows how to use both ways at the same time - from arduino to max and from max to arduino...
    Thanks again!

    • @Programmingforpeople
      @Programmingforpeople  8 ปีที่แล้ว +1

      +Shay Silver Hi again Shay,
      Ill add a note about this and see if I can throw something quick together for you within the next few days. Out of curiosity what sort of data are you trying to send back to arduino?

    • @cesarcofrer
      @cesarcofrer 5 ปีที่แล้ว

      Programming for People Hi, nice tutorial... I’m interested at the same!!! Do you have a tutorial about this?! I cant find it.... thanks!!!!!’

  • @daveklebt7732
    @daveklebt7732 7 ปีที่แล้ว

    I am using port e. (com 5 is where my Ard. is at.) only port a (com 1) is default is no port is defined. perhaps this is the issue.
    I cannot keep the serial port open in MAX and Arduino at the same time. when i close the port in MAX, it seems like it is purging the contents of what should be displayed in the serial monitor.
    The LED light does work - so i know the data is being sent on the toggle..

    • @Programmingforpeople
      @Programmingforpeople  7 ปีที่แล้ว

      +Dave Klebt the serial port is an individual thing shared between resources - you will not be able to have it open on arduino and send data to it in max. If max is sending the data you will need to print the data prior to the data to be able to see it when sending in max

    • @daveklebt7732
      @daveklebt7732 7 ปีที่แล้ว +1

      Thanks! i was attempting was to display the data as you did in the Arduino serial monitor. in my rebuild of your sketch/patch, the data doesn't show up in the serial monitor. but the LED does light, so i know the data on is being passed. is there to cache that data from a number stream when it comes into the Arduino through the serial?

    • @WeedyMan49
      @WeedyMan49 6 ปีที่แล้ว +2

      Hi ! I have exactly the same issue, "Serial Port 'COM7' already in use. Try quitting any programs that may be using it."
      All works fine and the RX LED on my Arduino board is blinking so data is send to it but I can't open the serial monitor within the Arduino application... Have you got any idea ? Thanks

  • @kingyiuchoi5056
    @kingyiuchoi5056 8 ปีที่แล้ว

    i have try to do the same things, but it always show me that there is port busy, is there any solution to fix this ?

    • @Programmingforpeople
      @Programmingforpeople  8 ปีที่แล้ว

      +King Yiu Choi From experience this is normally due to the serial monitor being open in Arduino.
      Whether going max > arduino or arduino > max I would always recommend starting the programs in this order - arduino, max.
      Let me know if it works!

    • @ryanbarney92
      @ryanbarney92 8 ปีที่แล้ว

      I too have been having same problem. Is the solution really a matter of opening each software in the right sequence? why is this the case?... help! please + thank you!

    • @Programmingforpeople
      @Programmingforpeople  8 ปีที่แล้ว +1

      +Ryan Barney
      Honest answer, I'm not sure... I have a couple of ideas that could be completely off the mark...
      my main guess is that pulling from the serial port is more taxing than printing too it. In a conventional program you would write the code in such a way that it opens, reads & then closes the serial port (freeing it up again). I doubt the rough way we are operating it in max correctly addresses that order.
      Im pretty sure MAX is pulling serial data out of sync in comparison to most procedural languages as well (much slower).
      If you were willing to put some time into it, gating the section of max code where we draw from the serial port should address this (eg we only access the data when we want something new rather than constantly polling it).
      That said, it could be something as simple as the way MAX sets up serial addresses when it 'creates' the channel by accessing it before arduino.

  • @apoloWND
    @apoloWND 7 ปีที่แล้ว

    what libraries do i need for this to work? specially "serial"

    • @Programmingforpeople
      @Programmingforpeople  7 ปีที่แล้ว

      +realgoldfinger all built into max.
      There was an error going around that serial would corrupt itself in various saves of max if you tried to close max with an active port. Start a new max patch and see if serial works.
      If not - you’re probably just not referencing the ports required correctly vs it being broken

  • @anamariamurderdoll
    @anamariamurderdoll 6 ปีที่แล้ว

    hi :) thanks for the video!
    can you help me with connecting a servo to this? im using FaceOSC on max, that sends data to the arduino, but i cant figure how to move a servo with that, i just need like 1 = servo on , 2 = servo off.
    Thankyou !!!! (and sorry about my english )

    • @Programmingforpeople
      @Programmingforpeople  6 ปีที่แล้ว +1

      You would most likely control something like that directly in arduino - having max control the on or off number (1 or 2 as your described)
      Servos normally move between 0 - 180 degrees of movement...
      So in arduino you would receive your OSC value within your loop code and set it equal to variable;
      You then use that variable to drive the servo...
      psuedocode:
      myValue = value from osc (normally from serial port)
      servovalue = 0
      if (myValue == 1)
      move servo on repeat
      else (nothing)

    • @anamariamurderdoll
      @anamariamurderdoll 6 ปีที่แล้ว

      @@Programmingforpeople thankyouuuu!!!!!!! :)