Revision fcd68623 examples/sensorapi/sensorapi.ino
examples/sensorapi/sensorapi.ino | ||
---|---|---|
78 | 78 |
displaySensorDetails(); |
79 | 79 |
|
80 | 80 |
/* Display system info (optional) */ |
81 |
bno.displaySystemStatus(); |
|
82 |
Serial.println(""); |
|
81 |
// bno.displaySystemStatus();
|
|
82 |
// Serial.println("");
|
|
83 | 83 |
|
84 | 84 |
/* Display chip revision details (optional) */ |
85 |
bno.displayRevInfo(); |
|
86 |
Serial.println(""); |
|
85 |
// bno.displayRevInfo();
|
|
86 |
// Serial.println("");
|
|
87 | 87 |
} |
88 | 88 |
|
89 | 89 |
/**************************************************************************/ |
... | ... | |
94 | 94 |
/**************************************************************************/ |
95 | 95 |
void loop(void) |
96 | 96 |
{ |
97 |
// Possible vector values can be: |
|
98 |
// - VECTOR_ACCELEROMETER - m/s^2 |
|
99 |
// - VECTOR_MAGNETOMETER - uT |
|
100 |
// - VECTOR_GYROSCOPE - rad/s |
|
101 |
// - VECTOR_EULER - degrees |
|
102 |
// - VECTOR_LINEARACCEL - m/s^2 |
|
103 |
// - VECTOR_GRAVITY - m/s^2 |
|
104 |
imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER); |
|
97 |
/* Get a new sensor event */ |
|
98 |
sensors_event_t event; |
|
99 |
bno.getEvent(&event); |
|
100 |
|
|
101 |
/* Display the floating point data */ |
|
105 | 102 |
Serial.print("X: "); |
106 |
Serial.println((int)euler.x(), DEC);
|
|
103 |
bno.printDouble(event.orientation.x, 1000);
|
|
107 | 104 |
Serial.print("Y: "); |
108 |
Serial.println((int)euler.y(), DEC);
|
|
105 |
bno.printDouble(event.orientation.y, 1000);
|
|
109 | 106 |
Serial.print("Z: "); |
110 |
Serial.println((int)euler.z(), DEC); |
|
111 |
Serial.println(""); |
|
112 |
|
|
113 |
/* |
|
114 |
imu::Quaternion quat = bno.getQuat(); |
|
115 |
Serial.print("qW: "); |
|
116 |
Serial.println((int)quat.w(), DEC); |
|
117 |
Serial.print("qX: "); |
|
118 |
Serial.println((int)quat.x(), DEC); |
|
119 |
Serial.print("qY: "); |
|
120 |
Serial.println((int)quat.y(), DEC); |
|
121 |
Serial.print("qZ: "); |
|
122 |
Serial.println((int)quat.z(), DEC); |
|
107 |
bno.printDouble(event.orientation.z, 1000); |
|
123 | 108 |
Serial.println(""); |
124 |
/* |
|
125 | 109 |
|
126 | 110 |
delay(BNO055_SAMPLERATE_DELAY_MS); |
127 | 111 |
} |
Also available in: Unified diff