20/20 Arduino IDE & Max Patche (button)



Button IDE:

 

#define BUTTON_PIN 2

void setup()

{

  Serial.begin(9600);

  pinMode(BUTTON_PIN, INPUT_PULLUP);

}

void loop()

{

  byte buttonState = digitalRead(BUTTON_PIN);

  

  if (buttonState == LOW) {

      Serial.println("1");

  }

  else {

      Serial.println("0");

  }

  delay(100);

}



Button Patch: 


{

"boxes" : [ {

"box" : {

"maxclass" : "newobj",

"text" : "itoa",

"outlettype" : [ "int" ],

"numinlets" : 3,

"id" : "obj-21",

"patching_rect" : [ 251.0, 361.0, 40.0, 22.0 ],

"numoutlets" : 1

}


}

, {

"box" : {

"maxclass" : "number",

"outlettype" : [ "", "bang" ],

"parameter_enable" : 0,

"numinlets" : 1,

"id" : "obj-20",

"patching_rect" : [ 407.0, 488.0, 50.0, 22.0 ],

"numoutlets" : 2

}


}

, {

"box" : {

"maxclass" : "newobj",

"text" : "fromsymbol",

"outlettype" : [ "" ],

"numinlets" : 1,

"id" : "obj-17",

"patching_rect" : [ 134.0, 389.0, 71.0, 22.0 ],

"numoutlets" : 1

}


}

, {

"box" : {

"maxclass" : "newobj",

"text" : "ctlout",

"numinlets" : 3,

"id" : "obj-15",

"patching_rect" : [ 314.0, 494.0, 40.0, 22.0 ],

"numoutlets" : 0

}


}

, {

"box" : {

"maxclass" : "newobj",

"text" : "sel 0 1 0 127",

"outlettype" : [ "bang", "bang", "bang", "bang", "" ],

"numinlets" : 5,

"id" : "obj-14",

"patching_rect" : [ 310.0, 422.0, 77.0, 22.0 ],

"numoutlets" : 5

}


}

, {

"box" : {

"maxclass" : "message",

"text" : "1",

"outlettype" : [ "" ],

"numinlets" : 2,

"id" : "obj-13",

"patching_rect" : [ 53.0, 449.0, 29.5, 22.0 ],

"numoutlets" : 1

}


}

, {

"box" : {

"maxclass" : "newobj",

"text" : "zl group 9600",

"outlettype" : [ "", "" ],

"numinlets" : 2,

"id" : "obj-11",

"patching_rect" : [ 126.0, 340.0, 81.0, 22.0 ],

"numoutlets" : 2

}


}

, {

"box" : {

"maxclass" : "newobj",

"text" : "sel 13 10",

"outlettype" : [ "bang", "bang", "" ],

"numinlets" : 3,

"id" : "obj-10",

"patching_rect" : [ 126.0, 272.0, 57.0, 22.0 ],

"numoutlets" : 3

}


}

, {

"box" : {

"maxclass" : "newobj",

"text" : "serial j 9600",

"outlettype" : [ "int", "" ],

"numinlets" : 1,

"id" : "obj-9",

"patching_rect" : [ 126.0, 206.0, 73.0, 22.0 ],

"numoutlets" : 2

}


}

, {

"box" : {

"maxclass" : "message",

"text" : "port j",

"outlettype" : [ "" ],

"numinlets" : 2,

"id" : "obj-8",

"patching_rect" : [ 236.0, 130.0, 35.0, 22.0 ],

"numoutlets" : 1

}


}

, {

"box" : {

"maxclass" : "message",

"text" : "print",

"outlettype" : [ "" ],

"numinlets" : 2,

"id" : "obj-6",

"patching_rect" : [ 60.0, 130.0, 32.0, 22.0 ],

"numoutlets" : 1

}


}

, {

"box" : {

"maxclass" : "newobj",

"text" : "sel 0",

"outlettype" : [ "bang", "" ],

"numinlets" : 2,

"id" : "obj-4",

"patching_rect" : [ 257.0, 47.0, 34.0, 22.0 ],

"numoutlets" : 2

}


}

, {

"box" : {

"maxclass" : "newobj",

"text" : "metro 100",

"outlettype" : [ "bang" ],

"numinlets" : 2,

"id" : "obj-3",

"patching_rect" : [ 111.0, 69.0, 63.0, 22.0 ],

"numoutlets" : 1

}


}

, {

"box" : {

"maxclass" : "toggle",

"outlettype" : [ "int" ],

"parameter_enable" : 0,

"numinlets" : 1,

"id" : "obj-2",

"patching_rect" : [ 110.0, 25.0, 24.0, 24.0 ],

"numoutlets" : 1

}


}

 ],

"lines" : [ {

"patchline" : {

"source" : [ "obj-9", 0 ],

"destination" : [ "obj-10", 0 ]

}


}

, {

"patchline" : {

"source" : [ "obj-8", 0 ],

"destination" : [ "obj-9", 0 ]

}


}

, {

"patchline" : {

"source" : [ "obj-6", 0 ],

"destination" : [ "obj-9", 0 ]

}


}

, {

"patchline" : {

"source" : [ "obj-4", 0 ],

"destination" : [ "obj-6", 0 ]

}


}

, {

"patchline" : {

"source" : [ "obj-3", 0 ],

"destination" : [ "obj-9", 0 ]

}


}

, {

"patchline" : {

"source" : [ "obj-21", 0 ],

"destination" : [ "obj-17", 0 ]

}


}

, {

"patchline" : {

"source" : [ "obj-2", 0 ],

"destination" : [ "obj-4", 0 ],

"order" : 0

}


}

, {

"patchline" : {

"source" : [ "obj-2", 0 ],

"destination" : [ "obj-3", 0 ],

"order" : 1

}


}

, {

"patchline" : {

"source" : [ "obj-17", 0 ],

"destination" : [ "obj-14", 0 ],

"order" : 0

}


}

, {

"patchline" : {

"source" : [ "obj-17", 0 ],

"destination" : [ "obj-13", 0 ],

"order" : 1

}


}

, {

"patchline" : {

"source" : [ "obj-14", 0 ],

"destination" : [ "obj-20", 0 ],

"order" : 0

}


}

, {

"patchline" : {

"source" : [ "obj-14", 0 ],

"destination" : [ "obj-15", 0 ],

"order" : 1

}


}

, {

"patchline" : {

"source" : [ "obj-11", 0 ],

"destination" : [ "obj-21", 0 ]

}


}

, {

"patchline" : {

"source" : [ "obj-10", 0 ],

"destination" : [ "obj-11", 0 ]

}


}

, {

"patchline" : {

"source" : [ "obj-10", 2 ],

"destination" : [ "obj-11", 0 ]

}


}

 ],

"appversion" : {

"major" : 8,

"minor" : 6,

"revision" : 5,

"architecture" : "x64",

"modernui" : 1

}

,

"classnamespace" : "box"

}

Comments