Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Based on Sparkfun LSM6DS3 Arduino Library
- // More info - https://goo.gl/x71qto
- // Sparfun product Code : https://www.sparkfun.com/products/13339
- #include "SparkFunLSM6DS3.h"
- #include "Wire.h"
- #include "SPI.h"
- //Create a instance of class LSM6DS3
- LSM6DS3 myIMU( I2C_MODE, 0x6A ); //I2C device address 0x6A
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- //Call .begin() to configure the IMUs
- if( myIMU.begin() != 0 )
- {
- Serial.println("Device error");
- }
- else
- {
- Serial.println("Device OK!");
- }
- }
- void loop()
- {
- //Accelerometer
- Serial.print("\nAccelerometer:\n");
- Serial.print(" X1 = ");
- Serial.println(myIMU.readFloatAccelX(), 4);
- Serial.print(" Y1 = ");
- Serial.println(myIMU.readFloatAccelY(), 4);
- Serial.print(" Z1 = ");
- Serial.println(myIMU.readFloatAccelZ(), 4);
- //Gyroscope
- Serial.print("\nGyroscope:\n");
- Serial.print(" X1 = ");
- Serial.println(myIMU.readFloatGyroX(), 4);
- Serial.print(" Y1 = ");
- Serial.println(myIMU.readFloatGyroY(), 4);
- Serial.print(" Z1 = ");
- Serial.println(myIMU.readFloatGyroZ(), 4);
- //Thermometer
- Serial.print("\nThermometer:\n");
- Serial.print(" Degrees C1 = ");
- Serial.println(myIMU.readTempC(), 4);
- Serial.print(" Degrees F1 = ");
- Serial.println(myIMU.readTempF(), 4);
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement