First things first.
- I do not know what you use to post code in a post on the forum, but please use code tags. It's the
</> button above the reply text box.
https://aws1.discourse-cdn.com/arduino/original/4X/7/6/0/76068b67427cb74e7360e74c52e2dd4455071975.png
- Can you post your saved patch; it will probably look like the patch below.
I have installed MaxMSP 8.5.1; still pre-trial so I can't save. I found SerialReadMaxMSP \ Learning \ Wiring which contains a MaxMSP patch to send H or L. I've adjusted it by changing the two boxes relating to the serial port (port h and serial h 115200 in below); you probably know how to change it in the patch itself, I haven't quite figured it out yet
Feel free to teach me 
Please note that I'm not familiar with MaxMSP so I can't exlain everything in the patch.
{
"boxes" : [ {
"box" : {
"maxclass" : "comment",
"text" : "atoi function to convert the characters H or L to integer befor sending them",
"patching_rect" : [ 209.0, 283.0, 405.0, 20.0 ],
"id" : "obj-27",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 0,
"fontsize" : 12.0
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "toggle to blink the LED every second",
"linecount" : 3,
"patching_rect" : [ 26.0, 12.0, 93.0, 48.0 ],
"id" : "obj-26",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 0,
"fontsize" : 12.0
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "toggle to send an H or an L to turn On or OFF the LED",
"linecount" : 4,
"patching_rect" : [ 147.0, 68.0, 93.0, 62.0 ],
"id" : "obj-25",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 0,
"fontsize" : 12.0
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 113.0, 69.0, 20.0, 20.0 ],
"id" : "obj-24",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "atoi",
"patching_rect" : [ 112.0, 290.0, 46.0, 20.0 ],
"id" : "obj-23",
"fontname" : "Arial",
"numinlets" : 3,
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "list" ]
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "H",
"patching_rect" : [ 156.0, 252.0, 32.5, 18.0 ],
"id" : "obj-22",
"fontname" : "Arial",
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "L",
"patching_rect" : [ 112.0, 252.0, 32.5, 18.0 ],
"id" : "obj-19",
"fontname" : "Arial",
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "select 0 1",
"patching_rect" : [ 113.0, 220.0, 62.0, 20.0 ],
"id" : "obj-14",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 3,
"fontsize" : 12.0,
"outlettype" : [ "bang", "bang", "" ]
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 26.0, 69.0, 20.0, 20.0 ],
"id" : "obj-13",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ]
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 25.0, 139.0, 20.0, 20.0 ],
"id" : "obj-12",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 1000",
"patching_rect" : [ 25.0, 104.0, 71.0, 20.0 ],
"id" : "obj-6",
"fontname" : "Arial",
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "bang" ]
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "toggle object to open/close the serial and start/stop the patch",
"linecount" : 3,
"patching_rect" : [ 196.0, 12.0, 150.0, 48.0 ],
"id" : "obj-18",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 0,
"fontsize" : 12.0
}
}
, {
"box" : {
"maxclass" : "toggle",
"patching_rect" : [ 166.0, 28.0, 20.0, 20.0 ],
"id" : "obj-17",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "int" ],
"bgcolor" : [ 1.0, 0.337255, 0.619608, 1.0 ]
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "select object with two options, to trigger messages, close and port ",
"linecount" : 2,
"patching_rect" : [ 315.0, 148.0, 227.0, 34.0 ],
"id" : "obj-16",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 0,
"fontsize" : 12.0
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "select 0 1",
"patching_rect" : [ 222.0, 153.0, 62.0, 20.0 ],
"id" : "obj-15",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 3,
"fontsize" : 12.0,
"outlettype" : [ "bang", "bang", "" ]
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "The serial object, port at 9600bps",
"patching_rect" : [ 209.0, 354.0, 188.0, 20.0 ],
"id" : "obj-11",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 0,
"fontsize" : 12.0
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "close",
"patching_rect" : [ 251.0, 252.0, 39.0, 18.0 ],
"id" : "obj-10",
"fontname" : "Arial",
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "add some message boxes and type their names for the basic communication, \"print\" (will print a list of serial ports), \"port a\" (to open the serial port) and \"close\" to close the serial port",
"linecount" : 6,
"patching_rect" : [ 315.0, 190.0, 175.0, 89.0 ],
"id" : "obj-9",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 0,
"fontsize" : 12.0
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "print",
"patching_rect" : [ 251.0, 190.0, 34.0, 18.0 ],
"id" : "obj-8",
"fontname" : "Arial",
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "port h",
"patching_rect" : [ 251.0, 220.0, 41.0, 18.0 ],
"id" : "obj-7",
"fontname" : "Arial",
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 12.0,
"outlettype" : [ "" ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial h 115200",
"patching_rect" : [ 112.0, 354.0, 79.0, 20.0 ],
"id" : "obj-4",
"fontname" : "Arial",
"numinlets" : 1,
"numoutlets" : 2,
"fontsize" : 12.0,
"outlettype" : [ "int", "" ]
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-15", 0 ],
"hidden" : 0,
"midpoints" : [ 175.5, 63.0, 249.0, 63.0, 249.0, 147.0, 231.5, 147.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-23", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-23", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-22", 0 ],
"destination" : [ "obj-23", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ 122.5, 240.0, 121.5, 240.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 1 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ 144.0, 249.0, 165.5, 249.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ 34.5, 207.0, 122.5, 207.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ 34.5, 126.0, 34.5, 126.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ 35.5, 90.0, 34.5, 90.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 1 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ 253.0, 186.0, 246.0, 186.0, 246.0, 213.0, 260.5, 213.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ 231.5, 249.0, 260.5, 249.0 ]
}
}
]
}
If you want to test it, copy the above (modified if needed) and paste it in a new patch. I have used the above patch to test the counter sketch (post #7) and it works as expected; if I click the H or the L box e.g. 3 times (each click within within 2 seconds of the previous one), I will get 3 flashes of the L LED on the Uno two seconds later.
This is what it looks like
Regarding your patch, I'm not sure how it is supposted to work; again, I know nothing about MaxMSP. But some comments
- The counter sketch times out after 2 seconds and will flash the L LED on the board based on the number of received bytes. Your metro is set for 100 milliseconds so as far as i understand it data will be send every 100 milliseconds; as a result the counter sketch will never time out and the LED will not flash. For testing purposes, change the metro in your patch to 10000 so it will only send every 10 seconds; this will make your counting of the flashes of the L LED easier.
- For now, I would not use a metro but simply a button to send the data to the counter sketch.
- I see that you have some additional boxes after the box serial f 115200 (compared to the patch above); is that to display data that is received from the Arduino?
That's it for now; I'm going to study how I can display results in MaxMSP that are received from the Arduino.