For anyone who has the same problem here is the arduino code and max 5 patcher.
{
"patcher" : {
"fileversion" : 1,
"rect" : [ 0.0, 44.0, 771.0, 614.0 ],
"bglocked" : 0,
"defrect" : [ 0.0, 44.0, 771.0, 614.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,
"boxes" : [ {
"box" : {
"maxclass" : "message",
"text" : "port a",
"patching_rect" : [ 279.0, 408.0, 41.0, 18.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"id" : "obj-29"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "close",
"patching_rect" : [ 280.0, 387.0, 39.0, 18.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"id" : "obj-27"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print",
"patching_rect" : [ 235.0, 496.0, 34.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-26"
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 255.0, 351.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"id" : "obj-23"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 10",
"patching_rect" : [ 208.0, 386.0, 58.0, 20.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "bang" ],
"fontsize" : 12.0,
"id" : "obj-22"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial a 9600",
"patching_rect" : [ 203.0, 435.0, 79.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Arial",
"outlettype" : [ "int", "" ],
"fontsize" : 12.0,
"id" : "obj-21"
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 410.0, 198.0, 50.0, 19.0 ],
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Verdana",
"outlettype" : [ "int", "bang" ],
"fontsize" : 10.0,
"id" : "obj-24"
}
}
, {
"box" : {
"maxclass" : "slider",
"patching_rect" : [ 413.0, 50.0, 20.0, 140.0 ],
"numinlets" : 1,
"bgcolor" : [ 0.94902, 0.94902, 0.94902, 0.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"size" : 256.0,
"id" : "obj-25"
}
}
, {
"box" : {
"maxclass" : "panel",
"patching_rect" : [ 412.0, 51.0, 21.0, 139.0 ],
"numinlets" : 1,
"grad1" : [ 1.0, 1.0, 1.0, 1.0 ],
"numoutlets" : 0,
"mode" : 1,
"grad2" : [ 0.509804, 0.509804, 0.509804, 1.0 ],
"angle" : 270.0,
"id" : "obj-28"
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 330.0, 200.0, 50.0, 19.0 ],
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Verdana",
"outlettype" : [ "int", "bang" ],
"fontsize" : 10.0,
"id" : "obj-9"
}
}
, {
"box" : {
"maxclass" : "slider",
"patching_rect" : [ 330.0, 50.0, 20.0, 140.0 ],
"numinlets" : 1,
"bgcolor" : [ 0.94902, 0.94902, 0.94902, 0.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"size" : 256.0,
"id" : "obj-10"
}
}
, {
"box" : {
"maxclass" : "panel",
"patching_rect" : [ 330.0, 50.0, 21.0, 139.0 ],
"numinlets" : 1,
"grad1" : [ 1.0, 1.0, 1.0, 1.0 ],
"numoutlets" : 0,
"mode" : 1,
"grad2" : [ 0.509804, 0.509804, 0.509804, 1.0 ],
"angle" : 270.0,
"id" : "obj-12"
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 264.0, 199.0, 50.0, 19.0 ],
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Verdana",
"outlettype" : [ "int", "bang" ],
"fontsize" : 10.0,
"id" : "obj-15"
}
}
, {
"box" : {
"maxclass" : "slider",
"patching_rect" : [ 264.0, 52.0, 20.0, 140.0 ],
"numinlets" : 1,
"bgcolor" : [ 0.94902, 0.94902, 0.94902, 0.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"size" : 256.0,
"id" : "obj-16"
}
}
, {
"box" : {
"maxclass" : "panel",
"patching_rect" : [ 264.0, 49.0, 21.0, 139.0 ],
"numinlets" : 1,
"grad1" : [ 1.0, 1.0, 1.0, 1.0 ],
"numoutlets" : 0,
"mode" : 1,
"grad2" : [ 0.509804, 0.509804, 0.509804, 1.0 ],
"angle" : 270.0,
"id" : "obj-18"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "pak i i i i i",
"patching_rect" : [ 140.0, 244.0, 73.0, 20.0 ],
"numinlets" : 5,
"numoutlets" : 1,
"fontname" : "Arial",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"id" : "obj-7"
}
}
, {
"box" : {
"maxclass" : "number",
"patching_rect" : [ 184.0, 201.0, 50.0, 19.0 ],
"numinlets" : 1,
"numoutlets" : 2,
"fontname" : "Verdana",
"outlettype" : [ "int", "bang" ],
"fontsize" : 10.0,
"id" : "obj-3"
}
}
, {
"box" : {
"maxclass" : "slider",
"patching_rect" : [ 184.0, 55.0, 20.0, 140.0 ],
"numinlets" : 1,
"bgcolor" : [ 0.94902, 0.94902, 0.94902, 0.0 ],
"numoutlets" : 1,
"outlettype" : [ "" ],
"size" : 256.0,
"id" : "obj-4"
}
}
, {
"box" : {
"maxclass" : "panel",
"patching_rect" : [ 184.0, 51.0, 21.0, 139.0 ],
"numinlets" : 1,
"grad1" : [ 1.0, 1.0, 1.0, 1.0 ],
"numoutlets" : 0,
"mode" : 1,
"grad2" : [ 0.509804, 0.509804, 0.509804, 1.0 ],
"angle" : 270.0,
"id" : "obj-5"