Max to Arduino

Yesterday, I came across a very useful video post by Takumi Ogata, or, as he is known on Youtube: Sound Simulator.

In the video he describes a basic priciple to transmit data from Max to Arduino.

In preparation for teaching this week, I thought that this coding example would form a simple basis to teach our second year cohort some of these principles. Through this process it allows us to include some additional commentary around the function of some areas of the coding. Specifically; there was some confusion in the original video post around the function of the buffering of incoming serial data (the buffer array, which can actually be any name at all as it is just a 2D array) and, moreover, expanding the use of arrays in general. This also gives us some scope to include more efficient coding principles i.e. using case/break statements for conditional elements to support the range based conditionals provided by the if statements in the original Arduino code.

In a nutshell, it is a little more efficient but based on the same basic idea (and commented a bit more).

An accompanying Max patch was created to support this which should facilitate swift development of projects that start in Max and are destined for the real-world via Arduino.

Figure shows: Max to Arduino Max Patch.

This Max Patch along with the Arduino code can be downloaded via bitbucket at the following link:

https://bitbucket.org/Nonzerojohn/maxtoarduino/src/master/

I will work on a PureData version of the Max Patch as time allows, but if you feel like contributing, let me know!

If you make something cool with it, send me a link, too!

For now, enjoy!