{"id":111,"date":"2007-10-10T22:02:29","date_gmt":"2007-10-11T03:02:29","guid":{"rendered":"http:\/\/www.tigoe.net\/pcomp\/code\/category\/code\/arduinowiring\/111"},"modified":"2007-10-10T22:21:49","modified_gmt":"2007-10-11T03:21:49","slug":"physical-pixel-controller","status":"publish","type":"post","link":"https:\/\/www.tigoe.com\/pcomp\/code\/arduinowiring\/111\/","title":{"rendered":"Physical Pixel Controller"},"content":{"rendered":"<p>This Max\/MSP patch turns on or off an LED attached to an Arduino. Max and the Arduino communicate serially.<\/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\/arduino\" rel=\"tag\">arduino<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/pcomp\" rel=\"tag\">pcomp<\/a>, <a href=\"http:\/\/www.technorati.com\/tag\/physical%20computing\" rel=\"tag\">physical computing<\/a><\/p>\n<p><!-- technorati tags end --><br \/>\n<!--more--><\/p>\n<pre>max v2;\r\n#N vpatcher 319 365 656 631;\r\n#P window setfont \"Sans Serif\" 9.;\r\n#P window linecount 1;\r\n#P comment 197 176 100 196617 Converts to integer;\r\n#P window linecount 2;\r\n#P comment 197 112 100 196617 bangs H for on , L for off;\r\n#P window linecount 1;\r\n#P newex 127 112 41 196617 sel 1 0;\r\n#P toggle 127 39 60 0;\r\n#P message 142 136 14 196617 L;\r\n#P newex 127 176 40 196617 atoi;\r\n#P message 127 136 14 196617 H;\r\n#P message 88 176 32 196617 print;\r\n#P newex 127 202 71 196617 serial a 9600;\r\n#P window linecount 2;\r\n#P comment 197 60 100 196617 Click here to turn on or off the LED;\r\n#P comment 14 146 98 196617 Click to get a list of the serial ports;\r\n#P connect 7 0 8 0;\r\n#P connect 8 0 4 0;\r\n#P fasten 6 0 5 0 147 163 132 163;\r\n#P fasten 4 0 5 0 132 163 132 163;\r\n#P fasten 5 0 2 0 132 197 132 197;\r\n#P fasten 3 0 2 0 93 197 132 197;\r\n#P connect 8 1 6 0;\r\n#P pop;<\/pre>\n<p>Arduino program:<\/p>\n<pre>int outputPin = 13;\r\nint val;\r\n\r\nvoid setup()\r\n{\r\n  Serial.begin(9600);\r\n  pinMode(outputPin, OUTPUT);\r\n}\r\n\r\nvoid loop()\r\n{\r\n  if (Serial.available()) {\r\n    val = Serial.read();\r\n    if (val == 'H') {\r\n      digitalWrite(outputPin, HIGH);\r\n    }\r\n    if (val == 'L') {\r\n      digitalWrite(outputPin, LOW);\r\n    }\r\n  }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This Max\/MSP patch turns on or off an LED attached to an Arduino.<\/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-111","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\/111","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=111"}],"version-history":[{"count":0,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/posts\/111\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/media?parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/categories?post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tigoe.com\/pcomp\/code\/wp-json\/wp\/v2\/tags?post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}