When it is above '6' in this case, it will trigger and print a value to the monitor. To demonstrate a simple use of the data, an if statement is constructed that monitors the value of the Z axis. ACCELEROMETER ADXL345 WIRE LIBRARY CODE SERIALThe data is then output to the serial monitor. With the data in hand we can break it down and store it in seperate variables. In the loop we first poll the sensor for fresh data. Next the setup launches the serial monitor, which provides a simple method to debug our output. These are then used to initialise a sensor object and event object that will interact with the module. First the Wire.h standard library, the Adafruit Unified Sensor Driver library and Adafruit ADX元45 Accelerometer Driver library are linked to the code. The code consists of includes, initialisations, a simple setup and loop. Wire the two boards together as can be seen in the image below, taking care to match the pin numbers. 4pcs Male to Female Jumper Cables - GBAA100002.1pcs Keyes ADX元45 3 Axis Accelerometer Module - BDAA100046.1pcs Arduino UNO or Compatible - LCAA100005.This will use the Adafruit Unified Sensor Driver library created by Adafruit Industries and the Adafruit ADX元45 Accelerometer Driver library created by Kevin Townsend for Adafruit Industries to interface with the chipset. Once stored, it will check and pass them to the serial monitor. This example will demonstrate the use of an Arduino UNO in selecting the module from the i2c bus and reading the sensors outputs. This will provide you with an entry point to using the module to track movement. Here is a quick introduction to using the Keyes ADX元45 3 axis acceleromter module.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |