Higher Values = Wider Measurement RangeĪdxl.setSpiBit(0) // Configure the device to be in 4 wire SPI mode when set to '0' or 3 wire SPI mode when set to 1 Serial.println("SparkFun ADX元45 Accelerometer Hook Up Guide Example") Īdxl.setRangeSetting(16) // Give the range settings Serial.begin(9600) // Start the serial terminal int interruptPin = 2 // Setup pin 2 to be the interrupt pin (for most Arduino Boards) ADX元45 adxl = ADX元45() // USE FOR I2C COMMUNICATION * Comment Out The One You Are Not Using */ĪDX元45 adxl = ADX元45(10) // USE FOR SPI COMMUNICATION, ADX元45(CS_PIN) * Bildr ADX元45 source file modified to support * Triple Axis Accelerometer Breakout - ADX元45 The watermark bit is cleared automatically whenįIFO is read, and the content returns to a value below the value stored in the sample bits. The watermark bit is set when the number of samples in FIFO equals the value stored in the sample bits (Register FIFO_CTL, Address 0x38). The FREE_FALL interrupt differs from the inactivity interrupt as follows: all axes always participate and are logically AND’ed, the timer period is much smaller (1.28 sec maximum), and the mode of operation is always dc-coupled. The FREE_FALL bit is set when the acceleration of less than the value stored in the THRESH_FF register (Address 0x28) is experienced for more time than is specified in the TIME_FF register (Address 0x29) on all axes (logical AND). The maximum value for TIME_INACT is 255 sec. Register (Address 0x26) on all participating axes, as set by the ACT_INACT_CTL register (Address 0x27). The inactivity bit is set when the acceleration of less than the value stored in the THRESH_INACT register (Address 0x25) is experienced for more time than is specified in the TIME_INACT The activity bit is set when acceleration greater than the value stored in the THRESH_ACT register (Address 0x24) is experienced on any participating axis, set by the ACT_INACT_CTL register. The DOUBLE_TAP bit is set when two acceleration events that are greater than the value in the THRESH_TAP register (Address 0x1D) occur for less time than is specified in the DUR register (Address 0x21), with the second tap starting after the time specified by the latent register (Address 0x22) but within the time specified in the window register (Address 0x23). The SINGLE_TAP bit is set when a single acceleration event that is greater than the value in the THRESH_TAP register (Address 0x1D) occurs for less time than is specified in the DUR register (Address 0x21). The DATA_READY bit is set when new data is available and is cleared when It is no more available. Here is the information from the datasheet. This device offers a good series of interrupt modes, which are very useful in smart/bio-metric logging. To connect with SPI, you must change the constructor Serial.print("Z: ") Serial.print() Serial.print(" ") Serial.println("m/s^2 ") Serial.print("Y: ") Serial.print() Serial.print(" ") Serial.print("X: ") Serial.print() Serial.print(" ") * Display the results (acceleration is measured in m/s^2) */ * Display additional settings (outside the scope of sensor_t) */ * Display some basic information on this sensor */ * Set the range to whatever is appropriate for your project */ Serial.println("Ooops, no ADX元45 detected. * There was a problem detecting the ADX元45. Serial.println("Accelerometer Test") Serial.println("") While (!Serial) // for Leonardo/Micro/Zero Serial.print ("Resolution: ") Serial.print(sensor.resolution) Serial.println(" m/s^2") Serial.print ("Min Value: ") Serial.print(sensor.min_value) Serial.println(" m/s^2") Serial.print ("Max Value: ") Serial.print(sensor.max_value) Serial.println(" m/s^2") Serial.print ("Unique ID: ") Serial.println(nsor_id) Serial.print ("Driver Ver: ") Serial.println(sensor.version) Serial.print ("Sensor: ") Serial.println(sensor.name) * Assign a unique ID to this sensor at the same time */Īdafruit_ADX元45_Unified accel = Adafruit_ADX元45_Unified(12345)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |