serial port issues
I'm pretty new to max msp and I'm trying to recreate this project. When I try to run this I get the notification "specified serial port not available". It looks functional in the arduino serial monitor and if I hit print in max msp the arduino port shows up in the console so I think I'm just missing something in my patch. Can someone help me figure out what's causing the problem?
I'm running Max 8.6.5 on a Mac with an M3 chip.
patch:
{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "print",
"id" : "obj-39",
"numinlets" : 1,
"patching_rect" : [ 240.0, 537.0, 32.0, 22.0 ],
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial",
"id" : "obj-35",
"numinlets" : 1,
"patching_rect" : [ 229.0, 486.0, 37.0, 22.0 ],
"numoutlets" : 2,
"outlettype" : [ "int", "" ]
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "print",
"id" : "obj-34",
"numinlets" : 2,
"patching_rect" : [ 210.0, 454.0, 32.0, 22.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s x",
"id" : "obj-32",
"numinlets" : 1,
"patching_rect" : [ 663.5, 519.0, 24.0, 22.0 ],
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s y",
"id" : "obj-31",
"numinlets" : 1,
"patching_rect" : [ 582.5, 519.0, 24.0, 22.0 ],
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "number",
"id" : "obj-30",
"parameter_enable" : 0,
"numinlets" : 1,
"patching_rect" : [ 664.0, 476.0, 50.0, 22.0 ],
"numoutlets" : 2,
"outlettype" : [ "", "bang" ]
}
}
, {
"box" : {
"maxclass" : "number",
"id" : "obj-28",
"parameter_enable" : 0,
"numinlets" : 1,
"patching_rect" : [ 582.5, 476.0, 50.0, 22.0 ],
"numoutlets" : 2,
"outlettype" : [ "", "bang" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "unpack f f",
"id" : "obj-26",
"numinlets" : 1,
"patching_rect" : [ 582.5, 432.0, 61.0, 22.0 ],
"numoutlets" : 2,
"outlettype" : [ "float", "float" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "fromsymbol",
"id" : "obj-25",
"numinlets" : 1,
"patching_rect" : [ 582.5, 390.0, 71.0, 22.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "itoa",
"id" : "obj-24",
"numinlets" : 3,
"patching_rect" : [ 582.5, 349.0, 40.0, 22.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl group 100",
"id" : "obj-21",
"numinlets" : 2,
"patching_rect" : [ 582.5, 300.0, 75.0, 22.0 ],
"numoutlets" : 2,
"outlettype" : [ "", "" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sel 13 10",
"id" : "obj-20",
"numinlets" : 3,
"patching_rect" : [ 582.5, 254.0, 57.0, 22.0 ],
"numoutlets" : 3,
"outlettype" : [ "bang", "bang", "" ]
}
}
, {
"box" : {
"maxclass" : "toggle",
"id" : "obj-19",
"parameter_enable" : 0,
"numinlets" : 1,
"patching_rect" : [ 583.0, 24.0, 56.0, 56.0 ],
"numoutlets" : 1,
"outlettype" : [ "int" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sel 0",
"id" : "obj-17",
"numinlets" : 2,
"patching_rect" : [ 656.0, 111.0, 34.0, 22.0 ],
"numoutlets" : 2,
"outlettype" : [ "bang", "" ]
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "port b",
"id" : "obj-16",
"numinlets" : 2,
"patching_rect" : [ 707.0, 149.0, 39.0, 22.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "port z",
"id" : "obj-14",
"numinlets" : 2,
"patching_rect" : [ 656.0, 149.0, 39.0, 22.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "print",
"id" : "obj-12",
"numinlets" : 2,
"patching_rect" : [ 608.5, 149.0, 32.0, 22.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial z 38400",
"id" : "obj-5",
"numinlets" : 1,
"patching_rect" : [ 583.0, 207.0, 83.0, 22.0 ],
"numoutlets" : 2,
"outlettype" : [ "int", "" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 10",
"id" : "obj-3",
"numinlets" : 2,
"patching_rect" : [ 583.0, 111.0, 56.0, 22.0 ],
"numoutlets" : 1,
"outlettype" : [ "bang" ]
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-20", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 1 ],
"destination" : [ "obj-39", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-34", 0 ],
"destination" : [ "obj-35", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 0 ],
"destination" : [ "obj-32", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-5", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-28", 0 ],
"destination" : [ "obj-31", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-26", 1 ],
"destination" : [ "obj-30", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-26", 0 ],
"destination" : [ "obj-28", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-25", 0 ],
"destination" : [ "obj-26", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-25", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-24", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-20", 0 ],
"destination" : [ "obj-21", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-20", 2 ],
"destination" : [ "obj-21", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-3", 0 ],
"order" : 1
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-17", 0 ],
"order" : 0
}
}
, {
"patchline" : {
"source" : [ "obj-17", 1 ],
"destination" : [ "obj-16", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-14", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-5", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-5", 0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-5", 0 ]
}
}
],
"appversion" : {
"major" : 8,
"minor" : 6,
"revision" : 5,
"architecture" : "x64",
"modernui" : 1
}
,
"classnamespace" : "box"
}

One thing to take into account is that only one application at a time can connect to a serial port. Make sure that all connections from the Arduino IDE/Monitor are closed.
To be in the safe that (and for possibly excluding that this is the culprit) , close all serial connections, then close all applications that might have connected to that port and restart Max.
Also: instead of connecting to a non existing port z to close the connection better use the close message.
replacing the messages with open and close instead of swapping the ports solved it, thank you!