Skip to content

Instantly share code, notes, and snippets.

@RobotGrrl
Created July 5, 2012 00:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobotGrrl/3050343 to your computer and use it in GitHub Desktop.
Save RobotGrrl/3050343 to your computer and use it in GitHub Desktop.
When connecting Processing to an Arduino (or whatever serial port)... this can come in handy in case the ports get scrambled! Arrg!
int port = 0;
for (int i=0; i<Serial.list().length; i++) {
println(Serial.list()[i]);
if (Serial.list()[i].equals("/dev/tty.usbserial-A900F5IY")) {
println("ding!");
port = i;
}
}
arduino = new Serial(this, Serial.list()[port], 9600);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment