You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/03.nano/boards/nano-33-ble/tutorials/imu-accelerometer/content.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -87,13 +87,13 @@ Now, connect the Arduino Nano 33 BLE to the computer and make sure that the Clou
87
87
88
88
Now we will write the code to read the accelerometer data, calculate the tilt angles, and print the relative position of the board as we move it at different angles.
89
89
90
-
-**Include the BMI270 library at the top of your sketch:**
90
+
**Include the BMI270 library at the top of your sketch:**
91
91
92
92
```arduino
93
93
#include "Arduino_BMI270_BMM150.h"
94
94
```
95
95
96
-
-**Initialize variables before the `setup()` function:**
96
+
**Initialize variables before the `setup()` function:**
97
97
98
98
```arduino
99
99
#define MINIMUM_TILT 5 // Threshold for tilt detection in degrees
@@ -105,7 +105,7 @@ Now we will write the code to read the accelerometer data, calculate the tilt an
105
105
unsigned long previousMillis = 0;
106
106
```
107
107
108
-
-**In the `setup()`, initialize the IMU and start serial communication:**
108
+
**In the `setup()`, initialize the IMU and start serial communication:**
109
109
110
110
```arduino
111
111
void setup() {
@@ -123,7 +123,7 @@ Now we will write the code to read the accelerometer data, calculate the tilt an
123
123
}
124
124
```
125
125
126
-
-**Write the `loop()` function to read accelerometer data and calculate tilt angles:**
126
+
**Write the `loop()` function to read accelerometer data and calculate tilt angles:**
127
127
128
128
```arduino
129
129
void loop() {
@@ -166,7 +166,7 @@ In this code, we use trigonometric functions to calculate the tilt angles from t
166
166
167
167
> **Note:** For the following code to work properly, the board's facing direction and inclination during the initialization of the code need to be specific. More information will be shared in the "Testing It Out" section.
168
168
169
-
**4. Complete Code**
169
+
**Complete Code**
170
170
171
171
If you choose to skip the code-building section, the complete code can be found below:
172
172
@@ -249,23 +249,23 @@ void loop() {
249
249
250
250
In order to get correct readings from the board:
251
251
252
-
1.**Initial Position:**
252
+
**Initial Position:**
253
253
254
254
Before uploading the sketch, place the board on a flat surface with the components facing upwards and the USB port pointing away from you. The image below illustrates the board's position and how it interacts with the X and Y axes:
255
255
256
256

257
257
258
-
2.**Uploading the Sketch:**
258
+
**Uploading the Sketch:**
259
259
260
260
- Verify and upload the sketch to the board.
261
261
- Open the Serial Monitor from the menu on the left.
262
262
263
-
3.**Interacting with the Board:**
263
+
**Interacting with the Board:**
264
264
265
265
-**Tilting Up/Down:** Tilt the board upwards or downwards to see the "Tilting up" or "Tilting down" messages.
266
266
-**Tilting Left/Right:** Tilt the board to the left or right to see the "Tilting left" or "Tilting right" messages.
267
267
268
-
4.**Observing the Output:**
268
+
**Observing the Output:**
269
269
270
270
The Serial Monitor will display the tilt direction and angle every half-second based on your movements.
0 commit comments