Using the I2C bus to control a digital accelerometer with the mraa library
Sometimes, the features included in the upm library for a specific sensor do not include all of its possible usages and configurations. An example of this situation is the upmAdxl345.Adxl345 class that we used in our previous example. This class doesn't allow us to configure the desired scale for the accelerometer while the sensor supports the following four selectable measurement ranges: ±2g, ±4g, ±8g and ±16g. If we want to use specific features that aren't included in the upm module, we can use the appropriate mraa class to interact with the sensor, in this case, we can use mraa.I2c to control the digital accelerometer through the I2C bus.
We will use the C++ source code for the upm module as a baseline to write our own Python code that controls the accelerometer through the I2C bus using the mraa.I2c class. The C++ source code file is adxl1345.cxx and it can be found in the following GitHub URL: http://github.com...