Max/MSP Patch: Receive Data From Serial Port
Using this patch you can receive data from the serial port which is then printed in its formatted form.
Click more to see the text for the patch.
{
"patcher" : {
"fileversion" : 1,
"rect" : [ 0.0, 46.0, 1600.0, 1098.0 ],
“bglocked” : 0,
“defrect” : [ 0.0, 46.0, 1600.0, 1098.0 ],
“openrect” : [ 0.0, 0.0, 0.0, 0.0 ],
“openinpresentation” : 0,
“default_fontsize” : 12.0,
“default_fontface” : 0,
“default_fontname” : “Arial”,
“gridonopen” : 0,
“gridsize” : [ 15.0, 15.0 ],
“gridsnaponopen” : 0,
“toolbarvisible” : 1,
“boxanimatetime” : 200,
“imprint” : 0,
“metadata” : [ ],
“boxes” : [ {
"box" : {
"maxclass" : "newobj",
"text" : "serial f 9600",
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "int", "" ],
“id” : “obj-1″,
“fontsize” : 11.595187,
“patching_rect” : [ 136.0, 176.0, 84.0, 20.0 ],
“numinlets” : 1
}
}
, {
“box” : {
“maxclass” : “toggle”,
“numoutlets” : 1,
“outlettype” : [ "int" ],
“id” : “obj-10″,
“patching_rect” : [ 348.0, 16.0, 43.0, 43.0 ],
“numinlets” : 1
}
}
, {
“box” : {
“maxclass” : “button”,
“numoutlets” : 1,
“outlettype” : [ "bang" ],
“id” : “obj-45″,
“patching_rect” : [ 301.0, 155.0, 20.0, 20.0 ],
“numinlets” : 1
}
}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “metro 500″,
“numoutlets” : 1,
“fontname” : “Arial”,
“outlettype” : [ "bang" ],
“id” : “obj-44″,
“fontsize” : 11.595187,
“patching_rect” : [ 262.0, 93.0, 63.0, 20.0 ],
“numinlets” : 2
}
}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “print formatted”,
“numoutlets” : 0,
“fontname” : “Arial”,
“id” : “obj-38″,
“fontsize” : 11.595187,
“patching_rect” : [ 57.0, 373.0, 85.0, 20.0 ],
“numinlets” : 1
}
}
, {
“box” : {
“maxclass” : “number”,
“numoutlets” : 2,
“fontname” : “Arial”,
“outlettype” : [ "int", "bang" ],
“id” : “obj-23″,
“fontsize” : 11.595187,
“patching_rect” : [ 148.0, 206.0, 50.0, 20.0 ],
“numinlets” : 1
}
}
, {
“box” : {
“maxclass” : “comment”,
“text” : “< start polling the serial port",
"numoutlets" : 0,
"fontname" : "Arial",
"id" : "obj-18",
"fontsize" : 11.595187,
"patching_rect" : [ 100.0, 114.0, 153.0, 20.0 ],
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "itoa",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "int" ],
"id" : "obj-8",
"fontsize" : 11.595187,
"color" : [ 0.356863, 0.768627, 0.0, 1.0 ],
"patching_rect" : [ 177.0, 331.0, 46.0, 20.0 ],
"numinlets" : 3
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl group 1000",
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "", "" ],
"id" : "obj-7",
"fontsize" : 11.595187,
"patching_rect" : [ 148.0, 282.0, 81.0, 20.0 ],
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "toggle",
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-6",
"patching_rect" : [ 72.0, 113.0, 20.0, 20.0 ],
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 500",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "bang" ],
"id" : "obj-5",
"fontsize" : 11.595187,
"patching_rect" : [ 72.0, 141.0, 63.0, 20.0 ],
"numinlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sel 13 90",
"numoutlets" : 3,
"fontname" : "Arial",
"outlettype" : [ "bang", "bang", "" ],
"id" : "obj-4",
"fontsize" : 11.595187,
"patching_rect" : [ 148.0, 239.0, 59.0, 20.0 ],
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "number",
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "int", "bang" ],
"id" : "obj-3",
"fontsize" : 11.595187,
"patching_rect" : [ 241.0, 144.0, 50.0, 20.0 ],
"numinlets" : 1
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "print",
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"id" : "obj-2",
"fontsize" : 11.595187,
"patching_rect" : [ 147.0, 137.0, 33.0, 18.0 ],
"numinlets" : 2
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-23", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-44", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-44", 0 ],
"destination" : [ "obj-45", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-44", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 2 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ 197.5, 274.0, 160.0, 274.0, 160.0, 279.0, 157.5, 279.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-38", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-23", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
}
Hi,
I was highlighting the post and opening it in Max/Msp (New from Clipboard) but it did not give me a patcher. Is this a code I need to use in a different way?
all the best