Max/MSP BlinkM patch

March 23rd, 2008

Below is the source for a Max/MSP patch that show how to control a BlinkM. Just copy the code below, then paste it into a new Max/MSP patcher. Simple as cake. This code is the companion to this post.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

#P user uslider 42 7 28 239 255 1 0 0;
#P user panel 40 5 32 259;
#X brgb 0 255 0;
#X frgb 0 255 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P hidden newex 125 202 67 196617 prepend port;
#P user umenu 114 129 133 196647 1 64 145 1;
#X add modem;
#X add usbserial-A4001IWR;
#X add Bluetooth-Modem;
#X add Bluetooth-PDA-Sync;
#X add;
#X add;
#P hidden newex 299 202 76 196617 loadmess print;
#N vpatcher 76 74 676 474;
#P outlet 31 253 20 0;
#P inlet 31 39 20 0;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P newex 311 203 127 196620 prepend setitem 7;
#B color 1;
#P newex 271 177 127 196620 prepend setitem 6;
#B color 1;
#P newex 231 152 127 196620 prepend setitem 5;
#B color 1;
#P newex 191 126 127 196620 prepend setitem 4;
#B color 1;
#P newex 150 204 121 196620 prepend setitem 3;
#B color 1;
#P newex 111 178 121 196620 prepend setitem 2;
#B color 1;
#P newex 71 153 121 196620 prepend setitem 1;
#B color 1;
#P newex 31 127 121 196620 prepend setitem 0;
#B color 1;
#P newex 31 96 293 196620 unpack s s s s s s s s;
#B color 1;
#P newex 31 66 93 196620 route port;
#B color 1;
#P window linecount 5;
#P comment 174 242 258 196620 Manages serial name data. Each port name (up to 8 \, in this case) replaces an item in the drop-down menu of the parent patch (items in drop-down are numbered 0 - 7).;
#B color 1;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P comment 72 30 491 196617 This code yoinked from Arduino2Max \, found at http://www.arduino.cc/playground/Interfacing/MaxMSP;
#P user panel 70 27 497 19;
#X brgb 255 107 125;
#X frgb 255 107 125;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 13 0 3 0;
#P lcolor 2;
#P connect 3 0 4 0;
#P lcolor 2;
#P connect 4 0 5 0;
#P lcolor 2;
#P connect 8 0 14 0;
#P lcolor 2;
#P connect 7 0 14 0;
#P lcolor 2;
#P connect 6 0 14 0;
#P lcolor 2;
#P connect 5 0 14 0;
#P lcolor 2;
#P connect 12 0 14 0;
#P lcolor 2;
#P connect 11 0 14 0;
#P lcolor 2;
#P connect 10 0 14 0;
#P lcolor 2;
#P connect 9 0 14 0;
#P lcolor 2;
#P connect 4 1 6 0;
#P lcolor 2;
#P connect 4 2 7 0;
#P lcolor 2;
#P connect 4 3 8 0;
#P lcolor 2;
#P connect 4 4 9 0;
#P lcolor 2;
#P connect 4 5 10 0;
#P lcolor 2;
#P connect 4 6 11 0;
#P lcolor 2;
#P connect 4 7 12 0;
#P lcolor 2;
#P pop;
#P hidden newobj 326 253 54 196617 p portinfo;
#P hidden newex 198 201 96 196617 prepend 1 0 4 0 99;
#P hidden newex 198 179 100 196617 receive frompalette;
#P hidden newex 198 226 77 196617 serial b 19200;
#P hidden newex 14 -18 67 196617 unpack 0 0 0;
#P hidden newex 14 -42 100 196617 receive frompalette;
#P hidden newex 113 -17 100 196617 receive fromsliders;
#P hidden newex 19 316 86 196617 send fromsliders;
#P hidden newex 113 46 86 196617 send frompalette;
#P hidden newex 25 269 44 196617 bondo 3;
#P hidden newex 19 292 57 196617 pack 0 0 0;
#P user uslider 75 7 28 239 255 1 0 0;
#P user uslider 8 7 28 239 255 1 0 0;
#P user swatch 113 5 128 32;
#P window linecount 3;
#P comment 253 128 118 196617 <-- Select the serial port that your arduino is connected to here.;
#P window linecount 2;
#P comment 105 170 267 196617 Now watch in amazement as you move the color selectors around and your BlinkM changes! Wow!;
#P user panel 108 123 264 45;
#X brgb 255 255 255;
#X frgb 255 208 157;
#X border 2;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 6;
#P comment 111 46 261 196617 Here we have two methods of changing colors. The sliders control the red \, green \, and blue channels individually \, and the color picker allows you to drag your cursor around and pick a color. Notice that they both react to each other. Edit the patch to see how that's working.;
#P user panel 6 5 32 259;
#X brgb 255 0 0;
#X frgb 255 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 73 5 32 259;
#X brgb 0 0 255;
#X frgb 0 0 255;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P hidden fasten 16 1 19 0 270 248 331 248;
#P hidden fasten 20 0 16 0 304 222 203 222;
#P hidden connect 18 0 16 0;
#P hidden fasten 22 0 16 0 130 222 203 222;
#P hidden connect 17 0 18 0;
#P hidden fasten 21 1 22 0 242 161 130 161;
#P hidden fasten 19 0 21 0 331 276 105 276 105 124 119 124;
#P hidden connect 6 0 11 0;
#P hidden connect 13 0 6 0;
#P hidden fasten 15 2 10 2 75 2 108 2 108 266 64 266;
#P lcolor 13;
#P hidden fasten 15 2 8 0 75 2 80 2;
#P hidden fasten 10 2 9 2 64 289 70 289;
#P hidden fasten 8 0 10 2 80 266 64 266;
#P hidden fasten 10 1 9 1 47 289 47 289;
#P hidden fasten 24 0 10 1 47 266 47 266;
#P hidden fasten 15 1 10 1 47 2 106 2 106 266 47 266;
#P lcolor 7;
#P hidden fasten 15 1 24 0 47 2 47 2;
#P hidden fasten 7 0 10 0 13 266 30 266;
#P hidden fasten 15 0 7 0 19 2 13 2;
#P hidden fasten 15 0 10 0 19 2 3 2 3 266 30 266;
#P lcolor 5;
#P hidden connect 9 0 12 0;
#P hidden fasten 10 0 9 0 30 289 24 289;
#P hidden connect 14 0 15 0;
#P window clipboard copycount 25;

Sorry, comments are closed for this article.