Guest User

Untitled

a guest
Oct 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. void loop() {
  2. // put your main code here, to run repeatedly:
  3. sensors_event_t event;
  4. bno.getEvent(&event);
  5.  
  6. Serial.print(F("Orientation: "));
  7. Serial.print((float)event.orientation.x);
  8. Serial.print(F(" "));
  9. Serial.print((float)event.orientation.y);
  10. Serial.print(F(" "));
  11. Serial.print((float)event.orientation.z);
  12. Serial.println(F(""));
  13.  
  14. Serial.print(F("Acceleration: "));
  15. Serial.print((float)event.acceleration.x);
  16. Serial.print(F(" "));
  17. Serial.print((float)event.acceleration.y);
  18. Serial.print(F(" "));
  19. Serial.print((float)event.acceleration.z);
  20. Serial.println(F(""));
  21.  
  22. delay(BNO055_SAMPLERATE_DELAY_MS);
  23. }
  24.  
  25. Orientation: 105.50 -20.56 -101.00
  26. Acceleration: 105.50 -20.56 -101.00
  27. Orientation: 97.81 -14.69 -119.56
  28. Acceleration: 97.81 -14.69 -119.56
  29. Orientation: 93.81 -10.94 -125.56
  30. Acceleration: 93.81 -10.94 -125.56
  31. Orientation: 94.44 -12.25 -122.56
  32.  
  33. sensors_event_t event;
  34. bno.getEvent(&event);
  35.  
  36. Serial.print(F("Orientation: "));
  37. Serial.print((float)event.orientation.x);
  38. Serial.print(F(" "));
  39. Serial.print((float)event.orientation.y);
  40. Serial.print(F(" "));
  41. Serial.print((float)event.orientation.z);
  42. Serial.println(F(""));
  43.  
  44. sensors_event_t event1;
  45. bno.getEvent(&event1);
  46. Serial.print(F("Acceleration: "));
  47. Serial.print((float)event1.acceleration.x);
  48. Serial.print(F(" "));
  49. Serial.print((float)event1.acceleration.y);
  50. Serial.print(F(" "));
  51. Serial.print((float)event1.acceleration.z);
  52. Serial.println(F(""));
  53.  
  54. delay(BNO055_SAMPLERATE_DELAY_MS);
  55.  
  56. sensors_event_t event;
  57. bno.getEvent(&event);
  58.  
  59. Serial.print(F("Orientation: "));
  60. Serial.print((float)event.orientation.heading);
  61. Serial.print(F(" "));
  62. Serial.print((float)event.orientation.pitch);
  63. Serial.print(F(" "));
  64. Serial.print((float)event.orientation.roll);
  65. Serial.println(F(""));
  66. Serial.print((float)event.acceleration.x); // same as roll
  67. Serial.println(F(""));
  68. Serial.print((float)event.acceleration.y); // same as pitch
  69. Serial.println(F(""));
  70. Serial.print((float)event.acceleration.z); // same as heading
  71. Serial.println(F(""));
  72.  
  73. sensors_event_t event;
  74. bno.getEvent(&event);
  75.  
  76. Serial.print(F("Orientation: "));
  77. Serial.print((float)event.orientation.heading);
  78. Serial.print(F(" "));
  79. Serial.print((float)event.orientation.pitch);
  80. Serial.print(F(" "));
  81. Serial.print((float)event.orientation.roll);
  82. Serial.println(F(""));
  83. // Serial.print((float)event.acceleration.x); // same as roll
  84. // Serial.println(F(""));
  85. // Serial.print((float)event.acceleration.y); // same as pitch
  86. // Serial.println(F(""));
  87. // Serial.print((float)event.acceleration.z); // same as heading
  88. // Serial.println(F(""));
  89.  
  90. imu::Vector<3> li_ac = bno.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER);
  91. Serial.print(F("Li. Acc.: "));
  92. Serial.print((float)li_ac.x());
  93. Serial.print(F(" "));
  94.  
  95. Serial.print((float)li_ac.y());
  96. Serial.print(F(" "));
  97.  
  98. Serial.print((float)li_ac.z());
  99. Serial.print(F(" "));
  100. Serial.println();
  101.  
  102. delay(BNO055_SAMPLERATE_DELAY_MS);
Add Comment
Please, Sign In to add comment