potentiometer to max via arduino uno

whorl's icon

Hi...bit of a desperate rush to get a project finished for deadline tomorrow!

I am trying to do something very simple, connect a single potentiometer to max, but the method I previously used is not working for some reason.

In the past I used ArduinoMaxInOutforDummies. However since upgrading to mavericks and (maybe max 6.1) I am getting no response inside max from the arduino.

Can anyone help me out with a quick way to get an analog pot signal into max? Sorry...bit stressed...

BTW I have tried and failed with maxuino as it doesn't seem to like uno boards.

Cheers!

brendan mccloskey's icon

wtf? reply just vanished?

Anyhoo
disclaimer: not familiar with Mavericks, but . . .

Ensure you have the correct driver installed:

Load the Standard Firmata (File/Examples/Firmata) onto the board, and go Tools/Board and Tools/Serial Port/ dev/tty . . .

Maxuino should behave.

Otherwise, do all of the above, leaving out Standard Firmata and Maxuino, then load this onto the board:

/*use the serial monitor window in Arduino to
verify the min and max values from the pot;
enter these values below
*/
int readPin = 0; //connect centre pin of pot to A0
int potRead; //variable to store the reading
int potMin = 0; //lowest pot value
int potMax = 1023; //highest pot value

void setup(){
Serial.begin (19200); //must match the argument to the serial object
}

void loop(){
potRead = analogRead(readPin); //read A0
potRead = map(readPin, potMin, potMax, 0, 255); //map onto 8 bit value
Serial.println(potRead); //delete this line and uncomment the next to send to Max
//Serial.write(potRead); //send to Max
delay(50); //samplerate = 20Hz
}

Use the "print" message to the serial object in Max to detect the available ports (see the Help file), and poll it with a [metro 50].

Should be ok.

Brendan

Scott Fitzgerald's icon

There is no need to install FTDI drivers when using an Uno. The 16U2 appears as a native USB device.

For a very easy example of how to get the value of one analog sensor, like a pot, into Max, look at the example included with the Arduino software under File > Examples > 4.Communication > Graph. The Arduino sketch is at the top, and a compressed Max 5 patch is included at the bottom.

Once piece of troubleshooting advice : There were changes with how serial ports enumerated in recent versions of OSX (after 10.8.x). In earlier versions of the OS, it would appear as the first item in a list (port "a" to the max serial object). Now it tends to be the last item. Depending on the number of serial connections your computer can make, it's a crapshoot where it could turn up. As Noob_Meister mentions, sending "print" to the serial object will show you what port the Arduino is attached to.

whorl's icon

Amazing help folks. I'll get onto it ASAP...

I did actually manage to get arduino2max doing what I wanted and it was relatively painless. Maxuino always seemed to have so much to offer but I could never get it rolling.

Thanks a lot for the help!