Arduino & Max MSP Patch and 2 or more videos

davethemoose's icon

Hi..I'm relative new to max/msp and am experimenting with motion sensors that start and stop video projections. I have successfully got one sensor working with one arduino + the max ardiono patch. This is all connected to a mac powerbook.

I am wondering if there is anyway I can get 2 sensors or more that trigger different video projections, depending on what sensor a person gets close to. For example sensor A triggers/video A and sensor B triggers /Video B and entirely different video.

I hope someone might have some solutions to this problem. Thanks

Adam's icon

Hi -

I think you should look into Maxuino. It's free and easy to find. Basically all you have to do is upload the Standard Firmata firmware to your Arduino then close the Arduino software. After that, load up the Maxuino software hookup your sensors and your pretty much good to go. I tried hooking up one light sensor to trigger different sounds and used [clip] to break up the range into several parts. You could use this idea plus several sensors to change not only the video but also maybe what part plays or how it plays etc... In general I found it to be pretty straightforward. I hope this helps a little.

Adam

the_man361's icon

you would need to label your sensors with an identifier bit/byte and then analyse and then mask that bit/byte inside of max, routing the signal to its relevant part of your patch.

for example, each sensor will send its data packet, maybe one byte of sensor data, preceded by an indentifier byte, maybe 0x00 for sensor one, 0x01 for sensor two. you might not need to use a whole byte though, if you only have two sensors you only need a bit, either 0 or 1. in max you will get two bytes for each sensor: 0x00 0x?? and 0x01 0x??. [atoi] will change ascii to integer values which i think will help with data analysis (display it as a hex value in the number box) and you can use the [zl] objects (some combination of [zl group] and something else if i remember correctly) to combine these groups of numbers into blocks of usable data. then you'd set up some logic in max to detect the preceding 0x00 or 0x01 and route accordingly :) hope that makes sense!

adam - ive had an arduino for some time now, but am a bit of a programming novice. i always intend to use it with max, but find a lot of things rather taxing. this maxuino patch sounds quite promising! thanks for the heads up. my arduino is not where i am right now, what kind of data comes out of the maxuino object then? just everything?

Adam's icon

the_man - It's actually pretty brilliant. It has different sections for digital, analog, and pwm. Digital readings appear as bangs. The analog readings come out between 0. and 1. PWM is handled by a slider. Each pin on the Arduino is handled individually. What's nice is that using send and receive you can route the information as you'd like. I've been experimenting with this in M4L and although my computer is hit pretty hard (it's a powerbook G4), the concept works. I haven't been able to get the hang of programming the Arduino, but this gets around that (at least for me). - Adam

the_man361's icon

sounds great, thanks for that :)

davethemoose's icon

thank you for all our posts, I really appreciate the input! David