Send data from TinyDuino to processing sketch via Bluetooth

maxouille

  • Newbie
  • *
    • Posts: 3
    • View Profile
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 !


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
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.


 

SMF spam blocked by CleanTalk