Arduino

Mar 28, 2011 at 7:52pm

Arduino

Hello everybody, any1 could tell me why Max dont recognize the input from arduino?!?!

When I press one of three buttons on the board, if I check the console, it gives me 1023 and the other 0. example, if I type the first and the last button on the board, the console returns me 1023, 0, 1023. so I assume that the Arduino is right, what I do not understand is why the part about “Max” does not work.
If anyone could help, I would only get a bang when I hit one of the three pins, I’m not interested in max tutorial I linked, it is only for reference.

Hardware / software
Macbookpro osX
arduino duemilanove
last released max (demo)

—arduino code—
const int redPin = A0; // sensor to control red color
const int greenPin = A1; // sensor to control green color
const int bluePin = A2; // sensor to control blue color

void setup()
{
Serial.begin(9600);
}

void loop()
{
Serial.print(analogRead(redPin));
Serial.print(“,”);
Serial.print(analogRead(greenPin));
Serial.print(“,”);
Serial.println(analogRead(bluePin));
}
—arduino code—

– Pasted Max Patch, click to expand. –
#55889
Mar 28, 2011 at 8:24pm

try the Arduino patch from the toolbox? you may have missed a setting somewhere, it’s finicky.

http://cycling74.com/toolbox/sensorbox/

also be sure you’re not asking for the serial from another program (close any open connection) when you ask for it from Max. check for error messages.

#200861
Mar 28, 2011 at 8:41pm

mhhhh what should i do whit sensorbox? just just attach the usb to my computer launch arduino code launch max code and press start->print->99?
if yes i guess i’ve missed something because nothing is appening

#200862
Mar 28, 2011 at 9:03pm

In order to use the SensorBox patch, you’ll need to load the SensorBox firmware on your Arduino board. Note that the digital pins are configured (internal pullups on) so that when connecting switches, you should connect them to ground. When starting up the patch, be sure to click ‘print’ message to get a menu with currently connected serial devices, and select your arduino board from that menu. Once that is done, click the 99 and turn on the toggle to get the whole thing rolling. You will know it’s working because usually the analog sliders will move around when you turn it on.

#200863
Mar 28, 2011 at 9:29pm

I thank you for the swift response, but I think I have big problems right now because every time I plug in the Arduino and use your program, the keyboard and trackpad of my macbook crashes and I have to turn off the computer by pressing power (which he asks me “want to turn off the machine” but could not move my mouse, I’m putting in a brute). however, during testing analog pins are moved, a few millimeters, only the last 3. I believe that it should not be to the final result.

#200864
Mar 28, 2011 at 10:24pm

Regarding the ‘Virtual Color Mixer’ example, as seejay mentioned, make sure you don’t have another application open using the serial port (like the Arduino IDE). Also, check and see that your board is showing up on port “a” (when we made the examples, they defaulted to that on OSX).

One other thing to bear in mind, the Arduino firmware software needs to wait about 5 seconds after a serial connection is established to start sending/receiving data.

Rereading your initial post, I just want to make sure you’re actually toggling the qmetro at the top of the patch, without that, you’ll get nowhere.

As far as getting a bang when pressing a button, a [sel 1023] would work, but you may want to move your buttons to the digital pins for the most reliable results.

#200865
Mar 30, 2011 at 9:06am

thanks for the reply Scott,
following the step by step what you told me I could run arduino and Max together, the problem is that after several attempts, trials, tests, drivers on my mac crashes when I try to open the doors to up, preventing me to use the trackpad and mac keyboard, seeing forced to use the single button still works, that is the power button to force shutdown. What should I do? I found a guide that says to remove the drivers and put them back but it goes back to 2008, I think the solution is somewhere else. the process that I follow is as follows.
1) active arduino
2) through the software I load the firmware
3) I check the connections and inputs are correct
4) I close my arduino software
5) I open max msp (Virtual Color Mixer)
6) I press print
7) wait for 5 seconds
8) I press “port a”(again, if it has not crashed already)
9) and if it is not crashed, it crashes

I hope you can help myself.

Thanks

#200866

You must be logged in to reply to this topic.