Hi Anton,
yes i check the doc on datasheet and i found that the chip need that delay ...
So I'm testing other sensor and i think that i have some problem on casting and conversion ... Now I'm working on HMC5843 sensor ...
254.129.1.2.255.147.0.
Ints x:249,1025,65428, Floats x:249.397949 y:1025.439575 z:65456.000000 Heading: 256.330449
nbyte:6
254.124.1.11.255.147.0.
nbyte:6
254.130.1.8.255.142.0.
Ints x:249,1025,65428, Floats x:249.397949 y:1025.439575 z:65456.000000 Heading: 256.330449
nbyte:6
254.130.1.8.255.144.0.
nbyte:6
254.130.1.8.255.144.0.
Ints x:249,1025,65428, Floats x:249.397949 y:1025.439575 z:65456.000000 Heading: 256.330449
nbyte:6
254.126.1.13.255.146.0.
nbyte:6
This is the debug .. the value retry by sensor change , but the old revision of code that used on avr don't work .. i think that there're difference on casting and allocation of variable.
Wire.beginTransmission(HMC5843_ADDR);
Wire.requestFrom(HMC5843_ADDR, 6);
if(6 == Wire.available()) {
// read out the 3 values, 2 bytes each.
xr = Wire.receive();
xr = (xr << 8) + Wire.receive();
*x= ((float) xr) / x_scale;
yr = Wire.receive();
yr = (yr << 8) + Wire.receive();
*y = ((float) yr) / y_scale;
zr = Wire.receive();
zr = (zr << 8) + Wire.receive();
*z = ((float) zr) / z_scale;
This is the old code , but don't work .. :(
I try this approach :
retval.ch[0]=ibuff2[0];
retval.ch[1]=ibuff2[1];
xr =retval.ival;
*x= ((float) xr) / x_scale;
retval.ch[0]=ibuff2[2];
retval.ch[1]=ibuff2[3];
yr =retval.ival;
*y = ((float) yr) / y_scale;
retval.ch[0]=ibuff2[4];
retval.ch[1]=ibuff2[5];
zr =retval.ival;
*z = ((float) zr) / z_scale;
But don't work ,too :(
Some suggestions ?
After i finish i upload on repo the lib for this kind of sensor .. as my 2 cents contribution :)