Serial SetUp with Error....

edited January 2015 in Library Questions

Hello everyone, are brand new to this world of Processing. Until now I have developed with the Arduino Wiring and I have to understand a few things. How is it possible to choose between COM1, 2, 3 .... when using: new Serial (this, Serial.list () [2], 115200); and because I have an error type: ArrayIndexOutOfBoundsException: 2? If I put [0] the error disappears but do not know which COM'm using ...

Thanks in advance for the help!

Simone

Tagged:

Answers

  • import processing.serial.*;
    
    String[] coms = Serial.list();
    
    println("Length: " + coms.length + '\n');
    println(coms);
    
    exit();
    
  • Many many thanks GoToLoop! I've correct the code with that and now it works!

    void setup ()
    {
       println ("");
       println (Serial.list());  //COM1 and COM4 appears
       println ("");
       String[] coms = Serial.list();
    
       // Open serial port to Arduino at 115200 baud
       duino = new Serial (this, coms[1], 115200);   // I'm choise the COM4
    

    :D :)>-

Sign In or Register to comment.