https://gist.github.com/aleksandyr/81757bc418e687755b50
does not work for me. I only get 0’s. I added:
const i2c_accel = 0x30;
hardware.configure(I2C_89);
local i2c = hardware.i2c89;
and server.log at end.
Please help!
I’ve loaded this code on my Hanah without modification (except server.log()) and it works…
Thanks for your input!
Obviously you added my 3 lines above? Did you also add this?
// the function reads the register 0Fh (Who I Am) and check that the result is correct: 33h
e = i2c.read(i2c_accel, “\x0F”, 1);
if(e != “\x33”){
server.log(“Can’t Enable Accelerometer”);
} else {
server.log(“Accelerometer OK”);
}
What does your server.log code look like?
What does the log say?
Do you have to shake it?
Can you guess what I’m doing wrong?
I got OK but then 0’s, so the hardware must be connected.
sorry, made a mistake. loaded wrong code.
I’ll try again
I understand your problem.
Have the same results.
hmm, code says it is for the LIS3DHTR, Hannah has LIS331DLTR.
I think I have to look for the differences.
I assume Aleks had it working. He has the Rev3 board?
yes, I suppose so. But all that bitshifting is out of my league.
Aleks, is your accel code for Rev2 or Rev3?