@@ -72,13 +72,20 @@ Prints the accelerometer and gyroscope values in the Serial Monitor.
72
72
``` python
73
73
import time
74
74
from lsm6dsox import LSM6DSOX
75
-
76
75
from machine import Pin, I2C
76
+
77
+ # Initialize the LSM6DSOX sensor with I2C interface
77
78
lsm = LSM6DSOX(I2C(0 , scl = Pin(13 ), sda = Pin(12 )))
78
79
79
- while (True ):
80
- print (' Accelerometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* lsm.read_accel()))
81
- print (' Gyroscope: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* lsm.read_gyro()))
80
+ while True :
81
+ # Read accelerometer values
82
+ accel_values = lsm.accel()
83
+ print (' Accelerometer: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* accel_values))
84
+
85
+ # Read gyroscope values
86
+ gyro_values = lsm.gyro()
87
+ print (' Gyroscope: x:{:>8.3f } y:{:>8.3f } z:{:>8.3f } ' .format(* gyro_values))
88
+
82
89
print (" " )
83
90
time.sleep_ms(100 )
84
91
```
@@ -791,7 +798,7 @@ while (True):
791
798
792
799
#### Temperature & Humidity (HTS221)
793
800
794
- Access the ` temperature ` & ` humidity ` values from the HTS221 sensor.
801
+ Access the ` temperature ` & ` humidity ` values from the HTS221 sensor (Nano 33 BLE Sense) .
795
802
796
803
``` python
797
804
import time
@@ -808,6 +815,25 @@ while (True):
808
815
time.sleep_ms(100 )
809
816
```
810
817
818
+ #### Temperature & Humidity (HS3003)
819
+
820
+ Access the ` temperature ` & ` humidity ` values from the HTS221 sensor (Nano 33 BLE Sense Rev2).
821
+
822
+ ``` python
823
+ import time
824
+ from hs3003 import HS3003
825
+ from machine import Pin, I2C
826
+
827
+ bus = I2C(1 , scl = Pin(15 ), sda = Pin(14 ))
828
+ hts = HS3003(bus)
829
+
830
+ while True :
831
+ rH = hts.humidity()
832
+ temp = hts.temperature()
833
+ print (" rH: %.2f%% T: %.2f C" % (rH, temp))
834
+ time.sleep_ms(100 )
835
+ ```
836
+
811
837
#### Pressure (LPS22)
812
838
813
839
Access the ` pressure ` values from the LPS22 sensor.
0 commit comments