okey, now i'm doing a project using an inclinometer SCA100T-D01 with arduino uno.
The problem is i want to read the data (angle) from inclinometer with my arduino.
But i'm confused how to program it, does anybody know the code to program it ?
it will be pleasure if any body want to share how to program it,
thank you
void loop()
{
int sudutx = readCommand(RDAX);
Serial.println("Sudut X = ");
Serial.println(sudutx);
int suduty = readCommand(RDAY);
Serial.println("Sudut Y = ");
Serial.println(suduty);
delay(1000);
}
word readCommand(byte Command)
{
byte inByte = 0;
word result = 0;
digitalWrite(CSpin, LOW);
delay(20);
SPI.transfer(Command);
result = SPI.transfer(MEAS);
result = result <<8;
inByte = SPI.transfer(MEAS);
result = result | inByte;
result = result >>5;
digitalWrite(CSpin, HIGH);
return(result);
}
with that code, the result is still Zero, both in X and Y axis, and somtime it change to 2047.
Please help me to solve this problem