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-r4/tutorials/01.user-manual/content.md
+31-28Lines changed: 31 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ This user manual provides a comprehensive overview of the Nano R4 board, highlig
31
31
32
32
### Software Requirements
33
33
34
-
-[Arduino IDE 2.0+](https://www.arduino.cc/en/software) or [Arduino Web Editor](https://create.arduino.cc/editor)
34
+
-[Arduino IDE](https://www.arduino.cc/en/software) or [Arduino Cloud Editor](https://create.arduino.cc/editor)
35
35
-[Arduino UNO R4 Boards core](https://github.com/arduino/ArduinoCore-renesas)
36
36
37
37
***The Nano R4 is compatible with the complete Arduino ecosystem and can be programmed directly as a standalone device.***
@@ -2336,6 +2336,8 @@ The Nano R4 implements a dual I²C bus architecture that separates +5 VDC and +3
2336
2336
2337
2337
Connecting Qwiic devices to your Nano R4 board is straightforward. Simply get a standard Qwiic cable (available in various lengths) and plug one end into the Nano R4's Qwiic connector and the other into your Qwiic device. Most Qwiic devices have two connectors, allowing you to daisy-chain multiple devices without any soldering or breadboarding. The polarized connectors prevent incorrect connections, making the setup process foolproof.
2338
2338
2339
+

2340
+
2339
2341
The Qwiic system's key advantages include:
2340
2342
2341
2343
-**Plug-and-play connectivity**: No breadboards, jumper wires, or soldering required
@@ -2346,7 +2348,7 @@ The Qwiic system's key advantages include:
2346
2348
2347
2349
### Working with Qwiic Devices
2348
2350
2349
-
The following example demonstrates how to use the Arduino Modulino Movement sensor via the Qwiic connector:
2351
+
The following example demonstrates how to use the [Arduino Modulino Movement](https://store.arduino.cc/collections/modulino/products/modulino-movement) sensor via the Qwiic connector:
2350
2352
2351
2353
```arduino
2352
2354
/**
@@ -2365,6 +2367,10 @@ Modulino Movement sensor via the Qwiic connector.
2365
2367
// Create Modulino Movement object
2366
2368
ModulinoMovement movement;
2367
2369
2370
+
// Variables for sensor data
2371
+
float x, y, z;
2372
+
float roll, pitch, yaw;
2373
+
2368
2374
void setup() {
2369
2375
// Initialize serial communication and wait up to 2.5 seconds for a connection
2370
2376
Serial.begin(115200);
@@ -2379,46 +2385,41 @@ void setup() {
2379
2385
Modulino.begin();
2380
2386
2381
2387
// Initialize Movement sensor
2382
-
if (!movement.begin()) {
2383
-
Serial.println("- Error: Modulino Movement not found!");
2384
-
Serial.println("- Please check Qwiic connection and reset");
2385
-
while (1) delay(10);
2386
-
}
2388
+
movement.begin();
2387
2389
2388
2390
Serial.println("- Modulino Movement connected successfully!");
2389
2391
Serial.println("- Reading motion data...\n");
2390
2392
}
2391
2393
2392
2394
void loop() {
2393
-
// Variables for sensor data
2394
-
float ax, ay, az; // Acceleration in g
2395
-
float gx, gy, gz; // Gyroscope in degrees/second
2395
+
// Read new movement data from the sensor
2396
+
movement.update();
2397
+
2398
+
// Get acceleration values
2399
+
x = movement.getX();
2400
+
y = movement.getY();
2401
+
z = movement.getZ();
2396
2402
2397
-
// Read sensor data
2398
-
movement.getAcceleration(ax, ay, az);
2399
-
movement.getGyroscope(gx, gy, gz);
2403
+
// Get gyroscope values
2404
+
roll = movement.getRoll();
2405
+
pitch = movement.getPitch();
2406
+
yaw = movement.getYaw();
2400
2407
2401
2408
// Display acceleration
2402
2409
Serial.print("- Accel (g): X=");
2403
-
Serial.print(ax, 2);
2410
+
Serial.print(x, 2);
2404
2411
Serial.print(" Y=");
2405
-
Serial.print(ay, 2);
2412
+
Serial.print(y, 2);
2406
2413
Serial.print(" Z=");
2407
-
Serial.print(az, 2);
2414
+
Serial.print(z, 2);
2408
2415
2409
2416
// Display gyroscope
2410
-
Serial.print(" | Gyro (dps): X=");
2411
-
Serial.print(gx, 1);
2412
-
Serial.print(" Y=");
2413
-
Serial.print(gy, 1);
2414
-
Serial.print(" Z=");
2415
-
Serial.print(gz, 1);
2416
-
2417
-
// Detect significant motion
2418
-
float totalAccel = sqrt(ax*ax + ay*ay + az*az);
2419
-
if (abs(totalAccel - 1.0) > 0.3) {
2420
-
Serial.print(" <- Motion!");
2421
-
}
2417
+
Serial.print(" | Gyro (dps): Roll=");
2418
+
Serial.print(roll, 1);
2419
+
Serial.print(" Pitch=");
2420
+
Serial.print(pitch, 1);
2421
+
Serial.print(" Yaw=");
2422
+
Serial.print(yaw, 1);
2422
2423
2423
2424
Serial.println();
2424
2425
@@ -2431,6 +2432,8 @@ void loop() {
2431
2432
2432
2433
You can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see the real-time acceleration and gyroscope data. Try moving or rotating the sensor to see the values change.
2433
2434
2435
+

2436
+
2434
2437
This example demonstrates the key aspects of using Qwiic devices with the Nano R4:
2435
2438
2436
2439
- Using `Wire1.begin()` instead of `Wire.begin()` for the Qwiic connector
0 commit comments