Accelerometer Troubles...

I'm using a 3-axis accelerometer and currently reading 2 axis only. i have used this in the past and it has worked fine. it worked fine even 30 mins back now suddenly i get a very weird error when running it and monitoring the serial port.

the code is as follows

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

void loop()
{
 
  Serial.print("X");
  Serial.println(analogRead(1));
  Serial.print("Y");
  Serial.println(analogRead(2));
//  Serial.print("Z :");
 // Serial.println(analogRead(4));
  delay(1000);
}

The error message i get is...

java.io.IOException: No error in nativeavailable

      at gnu.io.RXTXPort.nativeavailable(Native Method)

      at gnu.io.RXTXPort$SerialInputStream.available(RXTXPort.java:1532)

      at processing.app.Serial.serialEvent(Serial.java:206)

      at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)

      at gnu.io.RXTXPort.eventLoop(Native Method)

      at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575)

Error inside Serial.serialEvent()

After getting this message i have to restart arduino or otherwise my arduino board is not recognised. what could be wrong? also off late to start the arduino Ide i have to run the run.bat file from cmd prompt and it takes a lot of time to load.

The need to use run.bat to start Arduino is as far as i remember an indication that soemthing is "wrong" with the Java installation.

Try to see if there is an updated Java version for your OS

when i try running the java update it says i already have the latest version. My arduino board has compeltely stopped responding from arduino ide. :frowning: