hi everybody,
i just got my arduino board. i'm really happy with it because it works really well and is easy to use for someone who has no clue about phys. comp. (like me).
but one thing that really scares me is that my computer gets really bad freezes when using my board with max/msp.
i have simple test setup where i measure the light intensity with a photo-resistor. in max i use the serial object to get the data inside the computer and then use this data to drive a sine-oscillator. in the beginning it seems to work fine but sometimes, like when editing the patch or using some max-ui elements the computer doesn't react anymore: i can't use the mouse or the keyboard, but no error message or 'reboot screen' appear and for example iTunes keeps on playing...
really strange stuff and all i can do is shut down my computer by holding down the powerbutton. i'm on powerbook g4 ppc 1.67 Ghz, 1.5 gb ram, mac os 10.4.7, arduino 04 and max/msp 4.5.7.
maybe someone has an idea what could be wrong?
thanks a lot,
stephen
p.s: while using max/msp i always close the arduino-app so there should be no interference
// this is my max code
max v2;
#N vpatcher 37 59 851 872;
#P window setfont "Sans Serif" 9.;
#N vpatcher 37 59 637 459;
#P window setfont "Sans Serif" 9.;
#P newex 50 153 64 196617 fromsymbol;
#P newex 50 50 53 196617 sel 10 13;
#P newex 50 84 61 196617 zl group 64;
#P newex 50 116 40 196617 itoa;
#P inlet 50 30 15 0;
#P outlet 50 175 15 0;
#P connect 1 0 4 0;
#P connect 4 2 3 0;
#P connect 4 1 3 0;
#P connect 3 0 2 0;
#P connect 2 0 5 0;
#P connect 5 0 0 0;
#P pop;
#P newobj 133 256 58 196617 p asc2max;
#P message 58 454 37 196617 $1 20;
#P newex 58 478 53 196617 line~ 440;
#P user gain~ 58 595 24 100 158 0 1.071519 7.94321 10.;
#P message 116 700 29 196617 stop;
#P message 105 681 67 196617 startwindow;
#P newex 58 736 31 196617 dac~;
#P newex 58 539 40 196617 cycle~;
#P newex 58 396 31 196617 mtof;
#P newex 58 371 105 196617 scale 0 1024 84. 36.;
#N vpatcher 37 59 637 459;
#P window setfont "Sans Serif" 9.;
#P message 50 50 34 196617 1000;
#P message 95 51 14 196617 0;
#P inlet 50 30 15 0;
#P outlet 50 70 15 0;
#P outlet 95 71 15 0;
#P connect 2 0 4 0;
#P connect 4 0 1 0;
#P connect 2 0 3 0;
#P connect 3 0 0 0;
#P pop;
#P newobj 288 259 42 196617 p reset;
#P button 306 229 15 0;
#P number 58 326 48 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 296 318 70 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 226 317 45 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 227 287 40 196617 trough;
#P newex 291 289 40 196617 peak;
#P user multiSlider 203 378 238 183 0. 1000. 1 3433 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P newex 478 404 32 196617 print;
#P number 461 383 117 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 133 116 15 0;
#P newex 133 143 52 196617 metro 20;
#P message 62 198 44 196617 getbaud;
#P window linecount 2;
#P comment 228 197 358 196617 bang will cause received characters to be printed in Max window , and a count of read characters to be sent from the right outlet , prepended by 'read';
#P window linecount 7;
#P comment 189 45 243 196617 Arguments are: 1. letter abbreviation for port or port name -- a is the first logical port in your computer , b is the second , etc. (default a) ; 2. baud rate (default 4800) ; 3. data bits (default 8) ; 4. stop bits (default 1) ; 5. parity (default 0 (no)) ;;
#P window linecount 1;
#P message 155 201 32 196617 print;
#P button 119 175 15 0;
#P newex 133 227 71 196617 serial b 9600;
#P connect 27 0 15 0;
#P connect 15 0 18 0;
#P connect 18 0 19 0;
#P connect 19 0 26 0;
#P connect 26 0 25 0;
#P connect 25 0 20 0;
#P connect 20 0 24 0;
#P connect 24 0 21 0;
#P connect 23 0 21 0;
#P connect 22 0 21 0;
#P connect 24 0 21 1;
#P connect 7 0 6 0;
#P connect 1 0 0 0;
#P connect 2 0 0 0;
#P connect 5 0 0 0;
#P connect 6 0 0 0;
#P connect 0 0 27 0;
#P connect 27 0 10 0;
#P connect 12 0 13 0;
#P connect 27 0 12 0;
#P connect 17 0 12 1;
#P connect 16 0 17 0;
#P connect 27 0 11 0;
#P connect 11 0 14 0;
#P connect 17 1 11 1;
#P pop;
// this is the arduino code:
int analogInput = 3;
int value = 0;
void setup(){
// declaration of pin modes
pinMode(analogInput, INPUT);
// begin sending over serial port
Serial.begin(9600);
}
void loop(){
// read the value on analog input
value = analogRead(analogInput);
// print out value over the serial port
Serial.println(value);
delay(20);
}