<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with #bluefruit - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=%23bluefruit</link>
      <pubDate>Sun, 08 Aug 2021 20:41:11 +0000</pubDate>
         <description>Tagged with #bluefruit - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/tagged%23bluefruit/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Reading data from a bluetooth port</title>
      <link>https://forum.processing.org/two/discussion/22396/reading-data-from-a-bluetooth-port</link>
      <pubDate>Thu, 04 May 2017 21:12:02 +0000</pubDate>
      <dc:creator>Mat007</dc:creator>
      <guid isPermaLink="false">22396@/two/discussions</guid>
      <description><![CDATA[<p>Hello,
I am trying to read data sent by a nRF51822 Bluetooth LE module (Adafruit Feather M0 Bluefruit LE). I modified the bleuart_datamode sketch given as example to send the same data via bluetooth and USB serial.
I can see the Bluetooth data on my iPad with the Bluefruit LE connect app so I know that my board is sending stuff in the air. Using processing however I can read the serial data but I get a null string from bluetooth.
I suspected a baud rate problem so I tried everything... I don't get any error message though. The code is compiling and running but I get a null string...</p>

<p>Any idea ? Thanks !</p>

<pre><code>import processing.serial.*; 

Serial mySerialPort;          
Serial myBluePort;
PFont myFont;          
String serialString;       
String blueString;
int lf = 10;            // ASCII linefeed aka '/n'

void setup() { 

  frameRate(1000);
  size(400,200); 
  myFont = loadFont("ArialMT-18.vlw");  // Processing&gt;Tools&gt;Create Font 
  textFont(myFont, 18); 
  printArray(Serial.list());  

  mySerialPort = new Serial(this, Serial.list()[1], 115200); 
  mySerialPort.bufferUntil(lf); 

  myBluePort = new Serial(this, Serial.list()[0], 1200); 
  //myBluePort = new Serial(this, Serial.list()[0], 2400); 
  //myBluePort = new Serial(this, Serial.list()[0], 4800); 
  //myBluePort = new Serial(this, Serial.list()[0], 9600); 
  //myBluePort = new Serial(this, Serial.list()[0], 14400);
  //myBluePort = new Serial(this, Serial.list()[0], 19200); 
  //myBluePort = new Serial(this, Serial.list()[0], 28800); 
  //myBluePort = new Serial(this, Serial.list()[0], 38400); 
  //myBluePort = new Serial(this, Serial.list()[0], 57600); 
  //myBluePort = new Serial(this, Serial.list()[0], 76800); 
  //myBluePort = new Serial(this, Serial.list()[0], 115200); 
  //myBluePort = new Serial(this, Serial.list()[0], 230400); 
  //myBluePort = new Serial(this, Serial.list()[0], 250000); 
  //myBluePort = new Serial(this, Serial.list()[0], 460800); 
  //myBluePort = new Serial(this, Serial.list()[0], 921600); 
  //myBluePort = new Serial(this, Serial.list()[0], 1000000); 
   myBluePort.bufferUntil(lf);
} 

void draw() { 

  if ( mySerialPort.available() &gt; 0) serialString = mySerialPort.readString();
  if ( myBluePort.available() &gt; 0) blueString = myBluePort.readString();

  background(0); 
  text("Receiving serial data : " + trim(serialString), 10,20); 
  text("Receiving bluetooth data : " + trim(blueString), 10,40); 

} 
</code></pre>
]]></description>
   </item>
   </channel>
</rss>