Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Based on the SmartEverything LSM6DS3 Arduino Libraries
- // http://www.arduinolibraries.info/libraries/smart-everything-lsm6-ds3
- // Library code for LSM6DS3 iNEMO inertial module:3D accelerometer, 3D gyroscope
- #include <Arduino.h>
- #include "LSM6DS3.h"
- #include "Wire.h"
- void setup() {
- Wire.begin();
- Serial.begin(115200);
- while(!Serial){};
- gyroscope.begin();
- if(gyroscope.isActive()){
- Serial.println("Gyroscope Already Active");
- }else{
- if(gyroscope.powerOn()){
- Serial.println("Gyroscope Power ON");
- }else{
- Serial.println("Gyroscope Not Powered On");
- }
- }
- }
- void loop() {
- Serial.println("++++++++++++++++++++++++++++++++++++++++");
- Serial.println("Gyroscope Values ");
- Serial.print("Raw X = ");
- Serial.print(gyroscope.getRawXAxis());
- Serial.print(" Y = ");
- Serial.print(gyroscope.getRawYAxis());
- Serial.print(" Z = ");
- Serial.println(gyroscope.getRawZAxis());
- Serial.print("X = ");
- Serial.print(gyroscope.getConvertedXAxis(), 2);
- Serial.print("dms Y = ");
- Serial.print(gyroscope.getConvertedYAxis(), 2);
- Serial.print("dms Z = ");
- Serial.print(gyroscope.getConvertedZAxis(), 2);
- Serial.println("dms");
- Serial.println("++++++++++++++++++++++++++++++++++++++++");
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement