{"id":107,"date":"2007-10-10T21:39:29","date_gmt":"2007-10-11T02:39:29","guid":{"rendered":"http:\/\/www.tigoe.net\/pcomp\/code\/category\/uncategorized\/107"},"modified":"2007-10-30T10:26:17","modified_gmt":"2007-10-30T15:26:17","slug":"serial-graphing-application-for-maxmsp","status":"publish","type":"post","link":"https:\/\/www.tigoe.com\/pcomp\/code\/arduinowiring\/107\/","title":{"rendered":"Serial Graphing application for Max\/MSP"},"content":{"rendered":"<p>This Max patch takes in serial data and graphs it. It&#8217;s useful for seeing the changes in an analog sensor.  An Arduino code sample that works with it follows the patch.<\/p>\n<p>To use the patch, copy the text and paste it into a new max patch window.<\/p>\n<p>Thanks to David Mellis and Jamie Allen for the collaboration. These patches were written for a one-day Arduino workshop at NIME 07 hosted by the three of us. The Arduino program comes from the Arduino example files, by David Mellis.<\/p>\n<p><!-- technorati tags start --><\/p>\n<p style=\"text-align:right;font-size:10px;\">Technorati Tags: <a href=\"http:\/\/www.technorati.com\/tag\/serial\" rel=\"tag\">serial<\/a><\/p>\n<p><!-- technorati tags end --><br \/>\n<!--more--><br \/>\n<a href=\"'https:\/\/tigoe.com\/pcomp\/code\/wp-content\/uploads\/2007\/10\/analoggraph.png'%20title='analoggraph.png'\" title=\"'analoggraph.png'\"><img src='https:\/\/tigoe.com\/pcomp\/code\/wp-content\/uploads\/2007\/10\/analoggraph.thumbnail.png' alt='analoggraph.png' \/><\/a><\/p>\n<pre>max v2;\n#N vpatcher 149 116 801 639;\n#P user multiSlider 312 313 246 167 0. 1023. 1 3433 47 0 0 2 0 0 0;\n#M frgb 17 15 198;\n#M brgb 59 182 255;\n#M rgb2 127 127 127;\n#M rgb3 0 0 0;\n#M rgb4 37 52 91;\n#M rgb5 74 105 182;\n#M rgb6 112 158 18;\n#M rgb7 149 211 110;\n#M rgb8 187 9 201;\n#M rgb9 224 62 37;\n#M rgb10 7 114 128;\n#P window setfont \"Sans Serif\" 9.;\n#P comment 327 138 191 196617 Click here to get a list of serial ports;\n#P comment 210 293 97 196617 Here's your value;\n#P comment 380 271 215 196617 Convert ASCII to symbol;\n#P comment 380 248 215 196617 Convert integer to ASCII;\n#P number 312 292 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;\n#P newex 312 271 62 196617 fromsymbol;\n#B color 5;\n#P newex 312 248 40 196617 itoa;\n#B color 5;\n#P newex 312 225 55 196617 zl group 4;\n#P newex 256 187 67 196617 select 10 13;\n#P toggle 256 94 15 0;\n#P newex 256 116 46 196617 metro 1;\n#P message 291 138 32 196617 print;\n#P newex 256 163 71 196617 serial a 9600;\n#P window linecount 2;\n#P comment 61 116 191 196617 Read serial input buffer every 10 milliseconds;\n#P window linecount 3;\n#P comment 329 187 215 196617 If you get newline (ASCII 10) , send the list. If you get return (ASCII 13) do nothing. Any other value , add to the list;\n#P window linecount 1;\n#P comment 283 94 100 196617 Click to start;\n#P connect 6 0 5 0;\n#P connect 5 0 3 0;\n#P fasten 4 0 3 0 296 158 261 158;\n#P connect 3 0 7 0;\n#P fasten 7 0 8 0 261 216 317 216;\n#P fasten 7 2 8 0 317 228 317 228;\n#P connect 8 0 9 0;\n#P connect 9 0 10 0;\n#P connect 10 0 11 0;\n#P connect 11 0 16 0;\n#P pop;\n<\/pre>\n<p>Arduino code that sends in an analog value in the appropriate format:<\/p>\n<pre>void setup()\n{\n  Serial.begin(9600);\n}\n\nvoid loop()\n{\n  int val = analogRead(0);\n  Serial.println(val, DEC);\n  delay(100);\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This Max patch takes in serial data and graphs it&#8230;.  An Arduino code sample that works with it follows the patch.To use the patch, copy the text and paste it into a new max patch window.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,15],"tags":[],"class_list":["post-107","post","type-post","status-publish","format-standard","hentry","category-arduinowiring","category-MaxMSP"],"_links":{"self":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/comments?post=107"}],"version-history":[{"count":0,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/107\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/media?parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/categories?post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/tags?post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}