[maxmsp] Arduino, Max MSP & serial data
MarkDavid Hosale
markdavid at mdhosale.com
Mon Dec 10 08:02:43 MST 2007
- Previous message: [maxmsp] Arduino, Max MSP & serial data
- Next message: [maxmsp] Arduino, Max MSP & serial data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Joe- I am not sure what you are trying to do but I have some sample code that should address all of your questions: http://www.mdhosale.com/md_arduino/ If I understand you correctly, then I think you have some misconceptions about how the communication works between Arduino and Max's Serial object. > I'm very aware of the Serial.print function in the arduino code but > the serial object in max seems to ignore it until I send it a bang. This is the correct behavior. You need to bang the serial object regularly if you want the data to read and/or write consistently. You can think of this as a software side "polling" of the values, which happens independently of the cycling of the processor on the Arduino board, which is controlled in the Arduino code. Adjusting the software side "polling" in essence is a balance between application performance and quicker value reads. > I could very well send it a constant stream of timed bangs but I > get the feeling that's intensive, unnecessary and probably won't > work reliably at fast speed. You should keep the polling between 15 and 100 ms. As for servos, they need to be sent values at a regular rate of about 20 ms. Otherwise they get jumpy. > Mainly to control more than one servo, but also to possibly > increase my precision (I have a range of about 2550 with the servo, > but sending serial bytes means I have to multiply the input number > by ten, so my resolution is actually lower). I am confused by your range of 2550 (and the math), because usually servos are controlled via an angle of rotation. For example, 0-180 degrees depending on the specifications of the motor you are using. In the link above you can find examples of how to control several motors and receive input at the same time. hope this helps- MD On Dec 9, 2007, at 2:16 PM, Joe Bicker wrote: > Hi, I've been playing around with sending serial data to the > arduino board to controla servo motor, but it seems to be a case of > feeding it one bit at a time, much like you spoonfeed a baby rather > than giving it a whole meal to chew over. > I'd like to send more than one byte. Mainly to control more than > one servo, but also to possibly increase my precision (I have a > range of about 2550 with the servo, but sending serial bytes means > I have to multiply the input number by ten, so my resolution is > actually lower). > In order to do this, I figure I need to have some sort of > handshaking going on (getting the arduino to "ask" for the next > byte). I'm very aware of the Serial.print function in the arduino > code but the serial object in max seems to ignore it until I send > it a bang. > I could very well send it a constant stream of timed bangs but I > get the feeling that's intensive, unnecessary and probably won't > work reliably at fast speed. > > In short, what's the best way to send a byte from arduino to max, > and have that immediately trigger something in max, without any > user input? > > This would be a great help and greatly increase my chances of > success in my project, and I will prompty erect a shrine in your > honour (in my mind) > Cheers! > > Joe > _______________________________________________ > maxmsp mailing list > maxmsp at cycling74.com > http://www.cycling74.com/mailman/listinfo/maxmsp
- Previous message: [maxmsp] Arduino, Max MSP & serial data
- Next message: [maxmsp] Arduino, Max MSP & serial data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
