-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsensors.sh
executable file
·38 lines (33 loc) · 1.26 KB
/
sensors.sh
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
#! /usr/bin/python3
from sense_hat import SenseHat
import logging
from logging.handlers import TimedRotatingFileHandler
import time
logging.basicConfig(
format='%(asctime)s,%(levelname)s,%(message)s',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S',
handlers=[logging.StreamHandler(),
logging.handlers.TimedRotatingFileHandler("/home/pi/stem_club/logs/sensor", when="m", interval=10)
])
hat = SenseHat()
hat.set_rotation(90)
hat.set_imu_config(True, True, True)
hat.color.gain = 60
hat.color.integration_cycles = 64
while True:
red, green, blue, clear = hat.colour.colour
orientation = hat.get_orientation_degrees()
logging.info("pressure,%f", hat.get_pressure())
logging.info("temperature via humidity,%f", hat.get_temperature_from_humidity())
logging.info("temperature via pressure,%f", hat.get_temperature_from_pressure())
logging.info("temperature,%f", hat.get_temperature())
logging.info("humidity,%f", hat.get_humidity())
logging.info("light,%f", clear)
logging.info("red,%f", red)
logging.info("green,%f", green)
logging.info("blue,%f", blue)
logging.info("pitch,%f", orientation["pitch"])
logging.info("roll,%f", orientation["roll"])
logging.info("yaw,%f", orientation["yaw"])
time.sleep(1)