Projetc1

Homepage

  1. include "mbed.h"
  1. ifndef DFRobot_LIS2DH12_h
  2. define DFRobot_LIS2DH12_h
  1. include <stdlib.h>
  2. include <stdint.h>
  1. define LIS2DH12_RANGE_2GA 0x00
  2. define LIS2DH12_RANGE_4GA 0x10
  3. define LIS2DH12_RANGE_8GA 0x20
  4. define LIS2DH12_RANGE_16GA 0x30

class DFRobot_LIS2DH12 { public: static uint8_t sensorAddress; /< IIC address of the sensor int8_t init(uint8_t range); /< Initialization function void readXYZ(int16_t&, int16_t&, int16_t&); /< read x, y, z data void mgScale(int16_t&, int16_t&, int16_t&); /< transform data to millig /*!

  • Through the I2C to specify register read a single data
  • / uint8_t readReg(uint8_t); /*!
  • Through the I2C to specify register read more data
  • / void readReg(uint8_t, uint8_t *, uint8_t, bool autoIncrement = true); /*!