Problem with Arduino and tilt sensor accelerometer ADXL322

  1. In a processing code ,the cursor doesn't move on the screen to receive the x and y positions.

import java.awt.AWTException;
import java.awt.Robot;
import processing.serial.*;
Serial myPort;
arduMouse myMouse;

public static final short LF = 10; // linefeed in ASCII
public static final short portIndex = 1; // select the COM port,
// 0 is the first port
int posX, posY, btn; // data from msg fields will be stored here
void setup() {

size(200, 200);
println(Serial.list());
println(" Connecting to -> " + Serial.list()[portIndex]);

myPort = new Serial(this,Serial.list()[portIndex], 9600);
myMouse = new arduMouse();

btn = 0; // turn mouse off until requested by Arduino message
}
void draw() {
if ( myPort.available() > 0) { // If data is available,
serialEvent(myPort); // read it and store it in val
}
//if ( btn != 0)
myMouse.move(posX, posY); // move mouse to received x and y position
}
void serialEvent(Serial p) {
String message = myPort.readStringUntil(LF); // read serial data
if(message != null)
{
print(message);
String data = message.split(","); // Split the comma-separated message
if ( data[0].equals("Data"))// check for data header
{
if( data.length > 3 )

{
try {
posX = Integer.parseInt(data[1]);
posY = Integer.parseInt(data[2]);
btn = Integer.parseInt(data[3]);
}
catch (Throwable t) {
println("."); // parse error
print(message);
}
}
}
}
}

class arduMouse {
Robot myRobot; // create object from Robot class;
static final short rate = 4; // multiplier to adjust movement rate
int centerX, centerY;
arduMouse() {
try {
myRobot = new Robot();
}
catch (AWTException e) {
e.printStackTrace();
}
Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
centerY = (int)screen.getHeight() / 2 ;
centerX = (int)screen.getWidth() / 2;
}
// method to move mouse from center of screen by given offset
void move(int offsetX, int offsetY) {
myRobot.mouseMove(centerX + (rate* offsetX), centerY - (rate * offsetY));
}
2-how to connect the dongle BT +moduleBT+accelerometer in the arduino uno to make it wireless

Can anybody see a reason why? THANKS.

Can anybody see a reason why?

I can't see any Arduino code. (or any code tags)

void draw() {
  if ( myPort.available() > 0) {  // If data is available,
    serialEvent(myPort);         // read it and store it in val
  }
   //if ( btn != 0)       
     myMouse.move(posX, posY); // move mouse to received x and y position
}

The serialEvent() method is called automatically, when there is serial data. You look a bit like an idiot calling it yourself.

Hi
to whom it may concern,
am stuck want tohe help about how to connect module bt +arduino uno+accelerometer adxl322 on the breadboard
any help
thanks in advance

Regards,

BONA

Hi,

-how to connect the dongle BT +moduleBT+accelerometer in the arduino …
any help

Regards,

Steve