Max 4.6 #P window setfont "Sans Serif" 9.; #P window linecount 1; #N vpatcher 210 483 810 883; #P window setfont "Sans Serif" 9.; #P window linecount 1; #P message 412 142 92 196617 frgb 255 255 255; #P message 326 141 56 196617 frgb 0 0 0; #P window linecount 0; #P message 26 138 141 196617 clear \, paintoval \$1 \$2 \$3 \$4; #P window linecount 1; #P newex 424 95 53 196617 sel 255 0; #P newex 93 78 31 196617 + 10; #P newex 31 77 31 196617 + 10; #P window linecount 0; #P newex 20 102 66 196617 pack 0 0 0 0; #P outlet 28 348 15 0; #P inlet 423 60 15 0; #P inlet 121 39 15 0; #P inlet 18 46 15 0; #P connect 0 0 4 0; #P connect 4 0 8 0; #P connect 10 0 3 0; #P connect 9 0 3 0; #P connect 8 0 3 0; #P connect 0 0 5 0; #P connect 5 0 4 1; #P connect 1 0 4 2; #P connect 6 0 4 3; #P connect 1 0 6 0; #P connect 7 0 9 0; #P connect 7 1 10 0; #P connect 2 0 7 0; #P pop; #P newobj 240 663 97 196617 p "draw the circle"; #P user lcd 231 787 128 128 1 1 0 0 0; #P number 326 573 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 280 577 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P number 230 576 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 261 528 67 196617 unpack 0 0 0; #P newex 226 475 35 196617 t 65 l; #P newex 226 443 55 196617 zl group 3; #P newex 226 412 47 196617 gate 1 0; #P message 323 404 20 196617 65; #P newex 321 375 32 196617 sel 1; #P newex 368 377 27 196617 !- 1; #P toggle 368 336 15 0; #P newex 368 298 38 196617 sel 65; #P newex 368 267 47 196617 gate 1 1; #P newex 314 261 27 196617 0; #P window linecount 12; #P comment 511 484 100 196617 trigger (or [t]) forces right-left conventions. All the drawing and processing will happen before Max requests new values. When this trigger fires \, it sends an ASCII A to ask Arduino for new values.; #P window linecount 2; #P comment 395 170 100 196617 Click here to get a list of serial ports; #P window linecount 6; #P comment 431 270 100 196617 checks for the ascii value of "A" to begin cominucation. After initial communication is made \, this block shuts down.; #P window linecount 1; #P newex 218 200 71 196617 serial a 9600; #P message 299 163 33 196617 close; #P message 314 138 37 196617 port a; #P message 355 171 32 196617 print; #P newex 299 79 41 196617 sel 0 1; #P newex 218 80 57 196617 qmetro 10; #P window linecount 3; #P comment 122 82 100 196617 Read serial input buffer every 10 milliseconds; #P toggle 218 49 15 0; #P window linecount 29; #P comment 17 33 100 196617 Serial Call-Response Sends a byte out the serial port \, and reads 3 bytes in. Sets foregound color \, xpos \, and ypos of a circle using the values returned from the serial port. Note: This patch assumes that the device on the other end of the serial port is going to send a single byte of value 65 (ASCII A) on startup. The sketch waits for that byte \, then sends an ASCII A whenever it wants more data. created 14 Apr 2009 by Scott Fitzgerald and Tom Igoe; #P window linecount 1; #P comment 237 46 100 196617 click to start; #P connect 26 0 28 2; #P connect 25 0 28 1; #P connect 24 0 28 0; #P connect 28 0 27 0; #P connect 23 0 24 0; #P connect 23 1 25 0; #P connect 23 2 26 0; #P connect 22 1 23 0; #P fasten 22 0 9 0 231 513 172 513 181 171 223 171; #P connect 21 0 22 0; #P connect 20 0 21 0; #P connect 16 0 20 0; #P connect 16 0 18 0; #P connect 16 0 17 0; #P connect 9 0 20 1; #P connect 9 0 14 1; #P connect 19 0 9 0; #P connect 18 0 19 0; #P connect 13 0 16 0; #P connect 5 0 8 0; #P connect 5 0 13 0; #P fasten 17 0 14 0 373 411 416 411 416 250 373 250; #P connect 14 0 15 0; #P connect 15 0 16 0; #P connect 2 0 4 0; #P connect 2 0 5 0; #P connect 6 0 9 0; #P connect 7 0 9 0; #P connect 8 0 9 0; #P connect 4 0 9 0; #P connect 5 1 7 0; #P window clipboard copycount 29; PureData #N canvas 441 652 859 991 10; #X obj 44 221 comport 1 9600; #X obj 18 114 select 0 1; #X obj 18 81 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 ; #X msg 24 161 close; #X msg 155 168 ports; #X obj 125 251 route ports; #X obj 125 277 print port_list; #X text 154 187 will print out available ports to message window; #X text 45 80 toggle to open serial port; #X text 268 -37 Serial Call-Response Sends a byte out the serial port \, and reads 3 bytes in. Sets foregound color \, xpos \, and ypos of a circle using the values returned from the serial port. Note: This patch assumes that the device on the other end of the serial port is going to send a single byte of value 65 (ASCII A) on startup. The sketch waits for that byte \, then sends an ASCII A whenever it wants more data. Sept 28 \, 2010 by Scott Fitzgerald \, based off the Serial Call and Rsponse Max/MSP example by Tom Igoe and myself; #X obj -133 94 loadbang; #X msg -132 120 pollintervall 10; #X obj 38 408 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj -6 136 t 0 b; #X obj 50 369 sel 65; #X obj 38 439 t b f; #X msg 36 473 1; #X obj 42 517 - 0; #X obj 96 307 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 51 333 spigot 1; #X obj -11 439 sel 1; #X msg -12 465 65; #X obj -113 514 spigot; #X obj -115 544 zl group 3; #X obj -116 581 t 65 l; #X obj -84 632 unpack 0 0 0; #X floatatom -107 680 5 0 0 0 - - -; #X floatatom -49 681 5 0 0 0 - - -; #X floatatom 9 679 5 0 0 0 - - -; #X text -297 142 Read serial input buffer every 10 milliseconds; #X text 113 354 checks for the ascii value of "A" to begin cominucation. After initial communication is made \, this block shuts down.; #X text 54 401 reinitializes the gates when turned on and off; #X text -67 568 trigger (or [t]) forces right-left conventions. All the drawing and processing will happen before PD requests new values. When this trigger fires \, it sends an ASCII A to ask Arduino for new values.; #X text 21 660 val3; #X text -90 664 val1; #X text -35 662 val2; #X obj 347 538 cnv 15 140 65 empty empty empty 20 12 0 14 -195568 -66577 0; #X msg 362 558 destroy; #X text 358 537 Create window:; #N canvas 475 403 450 300 gemwin 0; #X obj 67 89 outlet; #X obj 67 10 inlet; #X obj 67 41 route create; #X msg 67 70 set destroy; #X msg 142 68 set create; #X msg 132 93 create \, 1 \, frame 2; #X msg 198 112 destroy \, reset; #X obj 132 136 gemwin 33; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 2 0 5 0; #X connect 2 1 4 0; #X connect 2 1 6 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 5 0 7 0; #X connect 6 0 7 0; #X restore 362 578 pd gemwin; #X obj 363 632 gemhead; #X obj 13 710 sel 255 0; #X msg 399 674 0 0 0; #X msg 462 671 1 1 1; #X obj 363 702 color 1 1 1; #X obj 360 831 circle; #X obj 360 777 translateXYZ; #X obj -107 713 / 255; #X obj -107 742 * 5; #X obj -104 769 - 2.5; #X obj -51 706 / 255; #X obj -51 735 * 5; #X obj -48 762 - 2.5; #X text 297 512 CLICk THIS FIRST TO OPEN THE RENDER WINDOW; #X msg 74 163 open 4; #X obj 146 475 print; #X connect 0 0 19 0; #X connect 0 0 22 0; #X connect 0 1 5 0; #X connect 1 0 13 0; #X connect 1 1 54 0; #X connect 2 0 1 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 5 0 6 0; #X connect 10 0 11 0; #X connect 11 0 0 0; #X connect 12 0 15 0; #X connect 12 0 20 0; #X connect 12 0 22 1; #X connect 13 0 12 0; #X connect 13 1 3 0; #X connect 14 0 12 0; #X connect 15 0 16 0; #X connect 15 1 17 1; #X connect 16 0 17 0; #X connect 17 0 18 0; #X connect 18 0 19 1; #X connect 19 0 14 0; #X connect 20 0 21 0; #X connect 21 0 0 0; #X connect 22 0 23 0; #X connect 23 0 24 0; #X connect 23 0 55 0; #X connect 24 0 0 0; #X connect 24 1 25 0; #X connect 25 0 26 0; #X connect 25 1 27 0; #X connect 25 2 28 0; #X connect 26 0 47 0; #X connect 27 0 50 0; #X connect 28 0 41 0; #X connect 37 0 39 0; #X connect 39 0 37 0; #X connect 40 0 44 0; #X connect 41 0 42 0; #X connect 41 1 43 0; #X connect 42 0 44 1; #X connect 43 0 44 1; #X connect 44 0 46 0; #X connect 46 0 45 0; #X connect 47 0 48 0; #X connect 48 0 49 0; #X connect 49 0 46 1; #X connect 50 0 51 0; #X connect 51 0 52 0; #X connect 52 0 46 2; #X connect 54 0 0 0;