public void closePort() {

    if (serial != null) {
      serial.stop();
      serial.dispose();
    }
    serial = null;
  }
示例#2
0
  public void P2() {

    buttonP0.setColorBackground(gray_);
    buttonP1.setColorBackground(gray_);
    buttonP2.setColorBackground(green_);
    // Open the port you are using at the rate you want:
    if (portopen == true) {
      myPort.stop();
    }
    myPort = new Serial(this, Serial.list()[2], 9600);
    portopen = true;
  }
 public void setPort(String portName) {
   if (portName != "") ;
   println(portName);
   if (serial != null) serial.stop();
   serial = new Serial(this, portName, 19200, 'O', 8, 1);
 }