In java I have the code
public void readAccel()
{
int l, h;
l = i2c.read(0x28);
h = i2c.read(0x29);
int x = ((h) << 8) | (l);
System.out.println(x);
}
in java. The accelerometer I have connected is working and communicating over i2c, the problem being that the two's complement number that is generated only seems to work in one direction; when I turn he device to one side the values scale from 0-256, but past zero the value jumps to 4096-3840. What Am I doing wrong?