title: How to setup serial communication in Processing to /dev/rfcomm0
body: <p>I am trying to perform serial communication on between Ubuntu 12.04 and a JY-MCU bluetooth serial module connected to an Arduino.</p>
  
  <p>I have created this configuration in /etc/bluetooth/rfcomm.conf</p>
  
  <pre><code>rfcomm0 {
  #   # Automatically bind the device at startup
      bind yes;
  #
  #   # Bluetooth address of the device    
      device 00:12:11:19:08:54
  #   # RFCOMM channel for the connection
      channel 1;
  #   # Description of the connection
      comment "Linvor Bluetooth Module";
  }
  </code></pre>
  
  <p>I can use putty to communicate with the /dev/rfcomm0 serial port and this works perfectly.</p>
  
  <p>However, despite many attempts I simply cannot see how to create a serial port in Processing that works in any way.</p>
  
  <p>For example :</p>
  
  <pre><code>println(Serial.list());
  </code></pre>
  
  <p>prints nothing at all.</p>
  
  <p>If I execute:</p>
  
  <pre><code>String portName = "/dev/rfcomm0";
  myPort = new Serial(this, portName, 9600);
  println(myPort);
  </code></pre>
  
  <p>I see this in the monitor:</p>
  
  <pre><code>processing.serial.Serial@1712651
  </code></pre>
  
  <p>But if I then call:</p>
  
  <pre><code> myPort.write('9');
  </code></pre>
  
  <p>I get an exception:</p>
  
  <pre><code>java.lang.NullPointerException
      at processing.serial.Serial.write(Serial.java:572)
      ...
  </code></pre>
  
  <p>I can't understand why this fails. I have been following all the instructions from Tom Igoe's "Making Things Talk", but this just does not work the way he says...</p>
  
  <p>Any help would b great!</p>
  
  <p>Thanks,</p>
  
  <p>Bob</p>