I'm just trying to translate that 2(15) value my math is crap
bit shit
/ = divide
3^3 = 333 (power of?)
so would that not mean
x1 = (long)ut - ac6) * ac5/215; (from PDF from bosh)
becomes
x1 = ((((long)ut - ac6) * ac5/2)^15; ?? really am clueless here lol
sorry my newb status with Arduino and C is really not helping... i'm trying to convert this line (x1=......) to something Arduino will compile so i can use it to correct
my other code... thanks, unless the example i posted is actually correct in which case i may have to return this sensor as it's not giving a correct reading.
"x >> 1" divides x by 2, so it follows that "x >> 2" divides x by four, and "x >> 3" divides x by eight.
Now, 2 = 21, 4 = 22 and 8 = 23.
You could write "x >> 3" as " ((x >> 1) >> 1) >> 1", with each successive operator halving thing previous result
Can you see where this is going?
(This isn't an "Arduino" operator, it's a C/C++ operator)
Perhaps it is a bit warmer where you are.
What are your values of ac5, ac6 and ut?
Here's the example code with the values from the example (uncompiled, untested)
void setup ()
{
Serial.begin (9600);
unsigned int ac5 = 32757; // these numbers all from the example
unsigned int ac6 = 23153; // these numbers all from the example
int mc = -8711; // these numbers all from the example
int md = 2868; // these numbers all from the example
long ut= 27898; // these numbers all from the example - you will read this from the device.
long x1 = ((long)ut - ac6) * ac5 >> 15;
long x2 = ((long) mc << 11) / (x1 + md);
long b5 = x1 + x2;
long t =((b5 + 8) )>> 4;
Serial.print ("x1 "); Serial.println (x1);
Serial.print ("t "); Serial.println (t);
}
void loop ()
{}