Simple serial data patch

jackytwoshoes's icon

I'm looking to build a simple patch that reads serial data from an Arduino.
I'd like a bang when the serial data reads 0.
My arduino is outputting 1's and 0's on usbmodem1d11.
Can someone help me with this code?

Medd's icon

In the Arduino IDE, go to: File->Examples->Communication->VirtualColorMixer

That's got a basic Max patch you can copy and open from the clipboard. If you want a bang when it reads a zero, look at the [select] object.

jackytwoshoes's icon

Thanks. That looks at arduino's analogue inputs though, right?
I'm not having any luck receiving the serial data from the arduino. If I monitor the serial port via the arduino IDE then I get a string of 1's and 0's, but i can't seem to display them in max.

jackytwoshoes's icon

This is coming along nicely.

I'm getting very close to it functioning just as it should.

It's reading serial data and detecting a change in its output signal.

Now, this patch has four audio tracks. I would like the audio tracks to play in sequence, looping back to the first when the last one ends, unless the serial data switch opens, in which case I would like the audio track to jump to the next track, then continue to play in sequence. I'm pretty sure I'm nearly there, just a tiny bit more help would be great!

3264.jackarduino.maxpat
Max Patch