Revision dd57d4fa
Adafruit_BNO055.cpp | ||
---|---|---|
71 | 71 |
setMode(OPERATION_MODE_CONFIG); |
72 | 72 |
|
73 | 73 |
/* Reset */ |
74 |
write8(BNO055_SYS_TRIGGER_ADDR, 0x20); //reset the sensor |
|
75 |
while (read8(BNO055_CHIP_ID_ADDR) != BNO055_ID) //wait for boot |
|
74 |
write8(BNO055_SYS_TRIGGER_ADDR, 0x20); |
|
75 |
while (read8(BNO055_CHIP_ID_ADDR) != BNO055_ID) |
|
76 |
{ |
|
76 | 77 |
delay(10); |
77 |
|
|
78 |
} |
|
78 | 79 |
delay(50); |
79 | 80 |
|
80 | 81 |
/* Set to normal power mode */ |
... | ... | |
84 | 85 |
write8(BNO055_PAGE_ID_ADDR, 0); |
85 | 86 |
|
86 | 87 |
/* Set the output units */ |
87 |
uint8_t unitsel = (0 << 7) | /* Orientation = Android */ |
|
88 |
(0 << 4) | /* Temperature = Celsius */ |
|
89 |
(0 << 2) | /* Euler = Degrees */ |
|
90 |
(1 << 1) | /* Gyro = Rads */ |
|
91 |
(0 << 0); /* Accelerometer = m/s^2 */ |
|
88 |
/* |
|
89 |
uint8_t unitsel = (0 << 7) | // Orientation = Android |
|
90 |
(0 << 4) | // Temperature = Celsius |
|
91 |
(0 << 2) | // Euler = Degrees |
|
92 |
(1 << 1) | // Gyro = Rads |
|
93 |
(0 << 0); // Accelerometer = m/s^2 |
|
92 | 94 |
write8(BNO055_UNIT_SEL_ADDR, unitsel); |
95 |
*/ |
|
93 | 96 |
|
94 | 97 |
write8(BNO055_SYS_TRIGGER_ADDR, 0x0); |
95 | 98 |
delay(10); |
... | ... | |
256 | 259 |
|
257 | 260 |
/* Read vector data (6 bytes) */ |
258 | 261 |
readLen((adafruit_bno055_reg_t)vector_type, buffer, 6); |
259 |
x = (((uint16_t)buffer[1]) << 8) | ((uint16_t)buffer[0]); |
|
260 |
y = (((uint16_t)buffer[3]) << 8) | ((uint16_t)buffer[2]); |
|
261 |
z = (((uint16_t)buffer[5]) << 8) | ((uint16_t)buffer[4]); |
|
262 |
|
|
263 |
x = ((int16_t)buffer[0]) | (((int16_t)buffer[1]) << 8); |
|
264 |
y = ((int16_t)buffer[2]) | (((int16_t)buffer[3]) << 8); |
|
265 |
z = ((int16_t)buffer[4]) | (((int16_t)buffer[5]) << 8); |
|
262 | 266 |
|
263 | 267 |
/* Convert the value to an appropriate range (section 3.6.4) */ |
264 | 268 |
/* and assign the value to the Vector type */ |
examples/bunny/bunny.pde | ||
---|---|---|
94 | 94 |
+----------+ |
95 | 95 |
| *| RST PITCH ROLL HEADING |
96 | 96 |
ADR |* *| SCL |
97 |
INT |* *| SDA ^ <-\
|
|
98 |
PS1 |* *| GND | |
|
|
99 |
PS0 |* *| 3VO Y Z--> X -/
|
|
97 |
INT |* *| SDA ^ /->
|
|
98 |
PS1 |* *| GND | | |
|
99 |
PS0 |* *| 3VO Y Z--> \-X
|
|
100 | 100 |
| *| VIN |
101 | 101 |
+----------+ |
102 | 102 |
*/ |
... | ... | |
111 | 111 |
Serial.println(F("")); |
112 | 112 |
|
113 | 113 |
delay(BNO055_SAMPLERATE_DELAY_MS); |
114 |
} |
|
114 |
} |
examples/bunny/processing/cuberotate/cuberotate.pde | ||
---|---|---|
82 | 82 |
translate(200, 300, 0); |
83 | 83 |
|
84 | 84 |
// Rotate shapes around the X/Y/Z axis (values in radians, 0..Pi*2) |
85 |
rotateZ(radians(roll * -1.0F));
|
|
85 |
rotateZ(radians(roll)); |
|
86 | 86 |
rotateX(radians(pitch)); |
87 |
rotateY(radians(yaw)); |
|
87 | 88 |
|
88 | 89 |
pushMatrix(); |
89 | 90 |
noStroke(); |
Also available in: Unified diff