Final Project: Max sending serial to Arduino – Multi Out from Ableton Live
Input audio is coming from Ableton Live through Sound Flower 16 to Max then Serial Send to Arduino.
Max Patch:
----------begin_max5_patcher----------
2936.3oc6cssiiiaD8Y2eEB94NNjEum21jEIAIOFfffrXQC01Z7ncbKYXqtm
M6hc+1ijH8EYaYSYRSqVSOMFeQxh5TmpXwpHKI8qOLZ7y4+bx5wQ+oneHZzn
e8gQip2T0FFY99nwuD+ySWDut9mM9kj0qimmL9Q89JR94h5smuLIayFyesXQ
RQw+aYhtkGON5GM65S4YEqS+k5cfQSPlMuLtX5mSyl+zpjoE5ChSjk6NhiIU
uQpeEymf11TYu9RZV44oFWfYioyzn44e5OPIi26jlE+R8Ic72sJMdw3csgFr
0MBtZi+1COT8xiNxGSWjuNwqDBSnzDBqlPnclPHhPPHYIes7jcDerL9KQo69
yulJrZxfIqeSxmvJYFYaLC+XlASCAy77qEE4s2I443r46j9SHlTh1..D0pdS
Whp2NsfhOgIf7lqniKxaW6tHccw0ngU06NhQ4UuoescML4DBN8NZ6eSnDIl6
HkPFZTh.ntQIfZnQIb.6HkvGZTBCXNRIrgFkPINZkfY2yXsjjHAJx7mWirPh
X5gbqG4EXrNGzEFeOYl+sWYCEU2yAWasPf53r5BYH42Sx3u3WxPyBLcjIWCY
Htmjw+wu8SnRGsLn2Sx3+5WxvDY10SF2Uuo+SuRFBpxQx.tmjw+vujAV3HYb
WmSi+tmyZG6HYftmjweyujAfbjLtqwY7W86LcYlOmqlLDx6IY789kL.WIC08
jL9WdkLnbvMx.C2USiuyurAnbkMtmY2uNYQD97SG5iNknBkJlvHJkPtkcjco
iSmIGvujC51PN5UTwUxQbmImaikiIQFWIG5fzxwjXiqjCaPZ4XRzwUxAFjVN
BrW5VQFjVNlDgbkbPCRKGShQtRN3AokiIQIGIGtbPZ4XRbxUxQMHsbLIR4J4
LLiP1jWkqjSPhyoHe97EsWnQoYEmslRTf1N.U+l1Wa0qVWQILQ.Jcn0EQnIb
hkkNSGREpR54bDsT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Gb5ZASA1dxhg6NXLwP.IpMPhFTHQrAR
jfBIvFHAAERXafDNXPRZSHAjvNTmTzCwjMgoPBaXJRVODS1DlBD1gUjjdHlr
Ij.HroGHw8OLIrI0NHrorHT8OLU+TS8hfBGZPw6efRXCljA1J2lQ7jgcBLD1
LhmLriBKrYDOYfsmrYDOYXSZQXyHdxvFYfvlQ7jgMwbgMi3IC6jpvswQtHrS
V.2lQ7DgMBJtUis.AlnXVApvN5B0FOTbVODSAlmromGW0CwTfWtEa7ZJv8PL
E3o80ln5D7dHlBajlLabZJn8PLE3kJyln5DPODSgMRShMisP5nebPQl.add8
vYS3RDiVUREBXBw73NZ21cUBv2BIfJJQp4Q6wMWBP2BI.gBmDX0DpzUI.yHA
TBD2BI.EPqHN4FHA7.ZDYU0x.z9Wko.8vJt.P8upa.q5eU2.NroC.VszXgMr
DvJGGgMEEvpgDCrMtUKkQfqLEaF1hGX+SVsLThfWYJhKAIHnUSPEj31.odVc
NgCulCYScfDPmSVgotAIUcsMqqvY11OG.tqiiIqwFVA5GTU3IhS7U8iuJPro
z3CPo.Q5Zj4rILAlB7cnG2PzLeSKJTeJJWJLIYWSSBlvofjQ1AdBeBvN9qZg
wbK9xOByEiCsiBiRMoRsHT6PeYZfri9lVTTHOJJWr.z65THvmHjLQUNRa.u.
0Pur4q5qtbrOElKkGEs6ynirpCiXG5M2BFa9MsnP7lnf7uqVWgjUKaUXSSEr
FSgK9F6pmEZPKpTPYKlBWs2RH1hovUhxDpsXJfUxsMXhF3TBshmvAseGQz+3
IJ4Vioxu7aO7+AXCB0E.
-----------end_max5_patcher-----------
Arduino:
const int buzz1 = 3;
const int buzz2 = 5;
const int buzz3 = 6;
const int buzz4 = 9;
const int buzz5 = 10;
const int buzz6 = 11;// the pin that the LED is attached to
int incomingByte; // a variable to read incoming serial data into
void setup() {
// initialize serial communication:
Serial.begin(9600);
// initialize the LED pin as an output:
pinMode(buzz1, OUTPUT);
pinMode(buzz2, OUTPUT);
pinMode(buzz3, OUTPUT);
pinMode(buzz4, OUTPUT);
pinMode(buzz5, OUTPUT);
pinMode(buzz6, OUTPUT);
}
void loop() {
// see if there’s incoming serial data:
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
incomingByte = Serial.read();
// if it’s a capital H (ASCII 72), turn on the LED:
if (incomingByte == ‘S’) {
analogWrite(buzz1, 70);
// analogWrite(buzz, 90);
}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘A’) {
analogWrite(buzz1, LOW);
}
if (incomingByte == ‘F’) {
analogWrite(buzz2, HIGH);
}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘D’) {
analogWrite(buzz2, LOW);
}
if (incomingByte == ‘H’) {
digitalWrite(buzz3, HIGH);
}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘G’) {
digitalWrite(buzz3, LOW);
}
if (incomingByte == ‘K’) {
analogWrite(buzz4, 200);
}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘J’) {
analogWrite(buzz4, LOW);
}
if (incomingByte == ‘X’) {
digitalWrite(buzz5, 100);
}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘Z’) {
analogWrite(buzz5, 200);
}
if (incomingByte == ‘V’) {
digitalWrite(buzz6, HIGH);
}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘C’) {
digitalWrite(buzz6, LOW);
}
}
}