File tree Expand file tree Collapse file tree 2 files changed +57
-44
lines changed
examples/Modulino_Movement Expand file tree Collapse file tree 2 files changed +57
-44
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Modulino Movement - Simple Serial Output
3
+ *
4
+ * This example code is in the public domain.
5
+ * Copyright (c) 2025 Arduino
6
+ * SPDX-License-Identifier: MPL-2.0
7
+ */
8
+
9
+ #include " Modulino.h"
10
+
11
+ // Create a ModulinoMovement
12
+ ModulinoMovement movement;
13
+
14
+ float x, y, z;
15
+ float gx, gy, gz;
16
+
17
+ void setup () {
18
+ Serial.begin (9600 );
19
+ // Initialize Modulino I2C communication
20
+ Modulino.begin ();
21
+ // Detect and connect to movement sensor module
22
+ movement.begin ();
23
+
24
+ }
25
+
26
+ void loop () {
27
+ // Read new movement data from the sensor
28
+ movement.update ();
29
+
30
+ // Get acceleration and gyroscope values
31
+ x = movement.getX ();
32
+ y = movement.getY ();
33
+ z = movement.getZ ();
34
+ gx = movement.getGyroX ();
35
+ gy = movement.getGyroY ();
36
+ gz = movement.getGyroZ ();
37
+
38
+ // Print acceleration values
39
+ Serial.print (" A: " );
40
+ Serial.print (x, 3 );
41
+ Serial.print (" , " );
42
+ Serial.print (y, 3 );
43
+ Serial.print (" , " );
44
+ Serial.print (z, 3 );
45
+
46
+ // Print divider between acceleration and gyroscope
47
+ Serial.print (" | G: " );
48
+
49
+ // Print gyroscope values
50
+ Serial.print (gx, 1 );
51
+ Serial.print (" , " );
52
+ Serial.print (gy, 1 );
53
+ Serial.print (" , " );
54
+ Serial.println (gz, 1 );
55
+
56
+ delay (200 );
57
+ }
You can’t perform that action at this time.
0 commit comments