-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sense_Logger_v1.py
41 lines (33 loc) · 982 Bytes
/
Sense_Logger_v1.py
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
35
36
37
38
39
40
41
from sense_hat import SenseHat
sense = SenseHat()
def get_sense_data():
sense_data=[]
sense_data.append(sense.get_temperature_from_humidity())
sense_data.append(sense.get_temperature_from_pressure())
sense_data.append(sense.get_humidity())
sense_data.append(sense.get_pressure())
o = sense.get_orientation()
yaw = o["yaw"]
pitch = o["pitch"]
roll = o["roll"]
sense_data.extend([pitch,roll,yaw])
mag = sense.get_compass_raw()
mag_x = mag["x"]
mag_y = mag["y"]
mag_z = mag["z"]
sense_data.extend([mag_x,mag_y,mag_z])
acc = sense.get_accelerometer_raw()
x = acc["x"]
y = acc["y"]
z = acc["z"]
sense_data.extend([x,y,z])
gyro = sense.get_gyroscope_raw()
gyro_x = gyro["x"]
gyro_y = gyro["y"]
gyro_z = gyro["z"]
sense_data.extend([gyro_x,gyro_y,gyro_z])
#sense_data.append(datetime.now())
return sense_data
while True:
sense_data = get_sense_data()
print(sense_data)