Blog > Re: Balancing Robot Accelerometer Drop- In Replacement

Home Forums Parallax Propeller: The Official Guide Balancing Robot Accelerometer Drop- In Replacement Re: Balancing Robot Accelerometer Drop- In Replacement

#11818

Anonymous

Or would it be better to do

a = read(MSB) << 8 + read(LSB) ‘ should give XXXX XXXX XXXX 0000

a = ((~~a) >> 4) & $0000_FFFF ‘ Sign-Extend 15 on a, then shift out the 4 LSB (which are padding zeros), then zero out value except the 16 LSbs

This should give me a value a:= 0 -65535 which is compatible with the updateBias method, is this correct???

Thanks Again,
Bryce