Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : ArrayIndexOutofBoundsException ERROR

$
0
0
The reason I am using  myPort = new Serial(this, Serial.list()[0], 9600); is because on one of the examples the code says that using that code any COM PORT when I plug my devices it ill take that new port and uses that one. In this case, I dont have to care about the port number and just write this code. 

// Example by Tom Igoe

import processing.serial.*;

// The serial port:
Serial myPort;

void setup() {
  // List all the available serial ports:
  println(Serial.list());
  // Open the port you are using at the rate you want:
  myPort = new Serial(this, Serial.list()[0], 9600);
}

void draw() {
  while (myPort.available() > 0) {
    int inByte = myPort.read();
    println(inByte);
  }
}


Thanks to everyone !! 

Viewing all articles
Browse latest Browse all 1768

Trending Articles