LIS3DH Analog input?

Posted on
  • Hi All,
    I'm wanting to use the LIS3DH analog inputs along with accelerometer. I'm getting totally lost on addressing, it would appear. When I set it up using the LIS3DH module using the default address and read the accelerometer, everything is fine. When I try the following setup, returns a timeout error.

    Gotta be something very simple that I'm doing wrong; help?


    I2C1.setup({sda:B7, scl:B6});
    var addr = 0x18; //chip addr
    read = function(reg, len) {
      I2C1.writeTo(addr, reg);
      return I2C1.readFrom(addr, len);
    write = function(reg, data) {
      I2C1.writeTo(addr, [reg, data]);
  • It seems from­s that the default address is 25 (0x19) - so that could be it?

    Also, if you've set up the LIS3DH module nothing stops you from calling acc.r(reg_addr) and acc.wr(reg_addr,data) which might save you some duplication.

  • Thanks @Gordon! I kept reading 0x18 in the documentation, but on closer look I do indeed have it at 0x19. Also appreciate your suggestions of using acc.r/w.

    I'm now talking to the chip, but having issues getting the A/D turned on. I'll spend some more time on it, but right now I'm not getting any values out of the A/D register (after writing the enabling bits). I'll spend more time later today on this, but appreciate your guidance as always!


  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

LIS3DH Analog input?

Posted by Avatar for billsalt @billsalt