I can't find information about how to import and collect data from an IMU on a sensehat connected to my raspberry pi. What do I write to import it and save the data?
I have made a code with the same function, however for the accelerometer:
import logging
import logzero
from logzero import logger
from sense_hat import SenseHat
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
sh = SenseHat()
logzero.logfile(dir_path+"/accel.csv")
formatter = logging.Formatter('%(name)s - %(asctime)-15s - %(levelname)s: %(message)s');
logzero.formatter(formatter)
acceleration = sense.get_accelerometer_raw()
x = acceleration['x']
y = acceleration['y']
z = acceleration['z']
x=round(x, 0)
y=round(y, 0)
z=round(z, 0)
logger.info("%s,%s,%s", x, y, z, )