Trouble writing Bluetooth

Hi I am trying to send x and y pixel data from Pixy2 camera to matlab using arduino+bluetooth. But have trouble getting it to work.

This code works other way - where I send angle information from Matlab to servo motor through Bluetooth and arduino.

Any suggestions are most welcome.

#include <Pixy2.h>

#include <Servo.h>
//String readString; //String captured from serial port
Servo myservo; // create servo object to control a servo
int pos = 80; //position value to write to servo

// This is the main Pixy object
Pixy2 pixy;

void setup()
{
Serial.begin(9600);

myservo.attach(9);

pixy.init();
}

void loop()
{

int i;

String strx;
String stry;

//int xcent =0;
// grab blocks!
pixy.ccc.getBlocks();

// If there are detect blocks, print them!
if (pixy.ccc.numBlocks)
{
//Serial.print("Detected ");
Serial.print(pixy.ccc.numBlocks);
Serial.print(":");

for (i=0; i<pixy.ccc.numBlocks; i++)
{

strx = String(pixy.ccc.blocks*.m_x);*
stry = String(pixy.ccc.blocks*.m_y);*

* Serial.print(strx);*
* Serial.print (",");*
* Serial.print(stry);*
* Serial.print ("&");*
* }*
* //Serial.println("$");*

* } *

* if (Serial.available() >0) {*

* pos = Serial.parseInt(); //convert readString into a number*
* if(pos >0){*
* myservo.write(pos);*
* }*
* delay(2);*
* }*

}

The biggest hint(s) I can give is:
1.) Make sure your bluetooth module is correctly wired
2.) Use Serial.print() (or Serial.write()) instead of Serial.read()

Make your best attempt and then tell us exactly what doesn't work if it doesn't.

Hi - thanks for the fast response - I think the wiring is correct - because the code works when I send data to servo from matlab to arduino using bluetooth. Its not working the other way - i.e from arduino to matlab via buetooth

Yes - I am using Serial print - but no luck

rnayak:
Yes - I am using Serial print - but no luck

Can you post your code with your edits?