{"id":109,"date":"2007-10-10T21:50:20","date_gmt":"2007-10-11T02:50:20","guid":{"rendered":"http:\/\/www.tigoe.net\/pcomp\/code\/category\/uncategorized\/109"},"modified":"2007-10-30T10:25:34","modified_gmt":"2007-10-30T15:25:34","slug":"ascii-to-number-in-maxmsp","status":"publish","type":"post","link":"https:\/\/www.tigoe.com\/pcomp\/code\/arduinowiring\/109\/","title":{"rendered":"Ascii to Number in Max\/MSP"},"content":{"rendered":"<p>This patch receives an ASCII-encoded decimal string that ends with a linefeed and carriage return in the serial port, and converts it to a number.  A Wiring\/Arduino program to send data to it follows. It&#8217;s based on an example by Jamie Allen.<\/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><!--more--><br \/>\n<a href=\"https:\/\/tigoe.com\/pcomp\/code\/wp-content\/uploads\/2007\/10\/asciitonumber.png\" title=\"asciitonumber.png\"><img decoding=\"async\" src=\"https:\/\/tigoe.com\/pcomp\/code\/wp-content\/uploads\/2007\/10\/asciitonumber.thumbnail.png\" alt=\"asciitonumber.png\" \/><\/a><\/p>\n<pre>max v2;\n#N vpatcher 275 262 515 549;\n#P window setfont \"Sans Serif\" 9.;\n#P number 108 244 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;\n#P newex 108 223 62 196617 fromsymbol;\n#B color 5;\n#P newex 108 200 40 196617 itoa;\n#B color 5;\n#P newex 108 177 55 196617 zl group 4;\n#P newex 52 139 67 196617 select 10 13;\n#P toggle 52 46 15 0;\n#P newex 52 68 52 196617 metro 10;\n#P message 87 90 32 196617 print;\n#P newex 52 115 71 196617 serial a 9600;\n#P connect 3 0 2 0;\n#P fasten 1 0 0 0 92 110 57 110;\n#P connect 2 0 0 0;\n#P connect 0 0 4 0;\n#P fasten 4 2 5 0 113 180 113 180;\n#P fasten 4 0 5 0 57 168 113 168;\n#P connect 5 0 6 0;\n#P connect 6 0 7 0;\n#P connect 7 0 8 0;\n#P pop;\n<\/pre>\n<p>Wiring\/Arduino program to send data:<\/p>\n<pre>void setup()\n{\n  Serial.begin(9600);\n}void 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 patch receives an ASCII-encoded decimal string that ends with a linefeed and carriage return in the serial port, and converts it to a number.<\/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-109","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\/109","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=109"}],"version-history":[{"count":0,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/109\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/media?parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/categories?post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/tags?post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}