This program initializes the GNSS and IMU devices, retrieves the current date, time, latitude, and longitude information, and reads the raw data from the accelerometer and gyroscope on the X, Y, and Z axes, then continuously prints this information.
from m5stack import *
from m5ui import *
from uiflow import *
import module
setScreenColor(0x222222)
gnss = module.get(module.GNSS)
gnss.init_gnss(1, 17, 16, 38400, 8, None, 1)
gnss.init_imu(0x68)
gnss.set_mode('normal')
while True:
print((str('date: ') + str((gnss.gnss_date))))
print((str('time: ') + str((gnss.gnss_time))))
print((str('latitude: ') + str((gnss.latitude))))
print((str('longitude: ') + str((gnss.longitude))))
print((str('IMU ACC rawX: ') + str((gnss.get_accel(1)[0]))))
print((str('IMU ACC rawY: ') + str((gnss.get_accel(1)[1]))))
print((str('IMU ACC rawZ: ') + str((gnss.get_accel(1)[2]))))
print((str('IMU GYRO rawX: ') + str((gnss.get_gyro(1)[0]))))
print((str('IMU GYRO rawY: ') + str((gnss.get_gyro(1)[1]))))
print((str('IMU GYRO rawZ: ') + str((gnss.get_gyro(1)[2]))))
wait_ms(2)
gnss.get_accel(0)[0]
gnss.get_accel(1)[0]
gnss.altitude
gnss.course
gnss.gnss_date
gnss.get_gyro(0)[0]
gnss.get_gyro(1)[0]
gnss.latitude
gnss.latitude_decimal
gnss.longitude
gnss.longitude_decimal
gnss.get_magneto(0)[0]
gnss.get_magneto(1)[0]
gnss.pos_quality
gnss.get_pressure
gnss.satellite_num
gnss.speed_knot
gnss.get_temperature
gnss.gnss_time
Retrieves the current time, returning a string representation of the time.
gnss.init_gnss(1, 17, 16, 38400, 8, None, 1)
gnss.init_imu(0x68)
gnss.set_acc_odr(0x09)
gnss.set_acc_range(0x00)
gnss.set_mode('normal')
gnss.set_acc_odr(0x09)
gnss.set_gyr_range(0x01)
gnss.set_magneto_odr(0x00)
gnss.set_time_zone(8)