TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: maxouille on October 08, 2015, 09:10:39 AM

Title: Send data from TinyDuino to processing sketch via Bluetooth
Post by: maxouille on October 08, 2015, 09:10:39 AM
Hello guys !

I'm trying to send data from arduino to processing sketch with the regular BT shield.

I am able to send data from the processing sketch to the TinyDuino but not from the TinyDuino to the computer.

Connect my shield to the PC create 2 COM Ports (In and out). To send data from the computer to the TinyDuino, I use the out port. So to retrieve data from the TinyDuino on the computer, I use the in port.

Here is my code, very simple one and does not work.
PROCESSING :
Code: [Select]
import processing.serial.*;
import java.lang.String;

Serial myPortRetrieve;
String myString = null;

void setup() {
 
 println(Serial.list());
 //IN PORT
 myPortRetrieve = new Serial(this, Serial.list()[1], 9600);
 myPortRetrieve.bufferUntil(10);
 myPortRetrieve.clear();
}

void draw() {
  while (myPortRetrieve.available() > 0) {
    myString = myPortRetrieve.readStringUntil(10);
 }
  if (myString != null) {
   println(myString);
  }
}

ARDUINO :
Code: [Select]
void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.println("heelo world !");
  delay(1000); 
}

Thx !
Title: Re: Send data from TinyDuino to processing sketch via Bluetooth
Post by: Ben Rose on October 15, 2015, 03:14:34 PM
It's good that you have data going one way- what examples are you basing the Processing code from? Unfortunately I'm not familiar with handling serial coms in Processing. Let us know if it's still not working.