-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_classes.py
More file actions
34 lines (26 loc) · 878 Bytes
/
example_classes.py
File metadata and controls
34 lines (26 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
#
# Show the main interfaces of the three sensor classes
#
#
from time import sleep
from altimu.lsm6ds33 import LSM6DS33
from altimu.lis3mdl import LIS3MDL
from altimu.lps25h import LPS25H
imu = LSM6DS33() # Accelerometer and Gyroscope
imu.enable()
magnet = LIS3MDL() # Magnetometer
magnet.enable()
baro = LPS25H() # Barometric and Temperature
baro.enable()
while True:
print "Gyro:", imu.getGyroscopeRaw()
print "Accelerometer:", imu.getAccelerometerRaw()
print "Magnet:", magnet.getMagnetometerRaw()
print "hPa:", baro.getBarometerMillibars()
print "Altitude (m):", baro.getAltitude()
sleep(0.2)
print "Gyro Temperature:", imu.getLSMTemperatureCelsius()
print "Magnet Temperature:", magnet.getLISTemperatureCelsius()
print "Baro Temperature:", baro.getLPSTemperatureCelsius()
sleep(0.1)