We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f66ca2 commit 786e991Copy full SHA for 786e991
LSM303/lsm303dlh_combined.py
@@ -0,0 +1,16 @@
1
+from time import sleep
2
+import board
3
+import busio
4
+import adafruit_lsm303_accel
5
+import adafruit_lsm303dlh_mag
6
+
7
+i2c = busio.I2C(board.SCL, board.SDA)
8
+mag = adafruit_lsm303dlh_mag.LSM303DLH_Mag(i2c)
9
+accel = adafruit_lsm303_accel.LSM303_Accel(i2c)
10
11
+while True:
12
+ print("Acceleration (m/s^2): X=%0.3f Y=%0.3f Z=%0.3f"%accel.acceleration)
13
+ print("Magnetometer (micro-Teslas)): X=%0.3f Y=%0.3f Z=%0.3f"%mag.magnetic)
14
+ print("")
15
+ sleep(0.5)
16
0 commit comments