* Note: Must perform offset and gain calculations prior to seeing updated results Serial.print("Accel Maximums: ") Serial.print(AccelMaxX) Serial.print(" ") Serial.print(AccelMaxY) Serial.print(" ") Serial.print(AccelMaxZ) Serial.println() Serial.print("Accel Minimums: ") Serial.print(AccelMinX) Serial.print(" ") Serial.print(AccelMinY) Serial.print(" ") Serial.print(AccelMinZ) Serial.println() Int x,y,z // init variables hold resultsĪdxl.readAccel(&x, &y, &z) // Read the accelerometer values and store them in variables declared above x,y,z While (!Serial.available()) // Waiting for character to be sent to Serial Serial.println("Send any character to display values.") * Accelerometer Readings and Min/Max Values */ SPI pins on the ATMega328 as reference in SPI Library are 11, 12, and 13 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 Breakout Calibration") Īdxl.setRangeSetting(2) // Give the range settings Serial.begin(9600) // Start the serial terminal ADX元45 adxl = ADX元45() // Use when you need I2C * Comment Out The One You Are Not Using */ĪDX元45 adxl = ADX元45(10) // Use when you want to use Hardware SPI, ADX元45(CS_PIN)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |