diff --git a/apps/com.example.imu/META-INF/MANIFEST.MF b/apps/com.example.imu/META-INF/MANIFEST.MF new file mode 100644 index 00000000..57ef1edc --- /dev/null +++ b/apps/com.example.imu/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +Name: IMU diff --git a/apps/com.example.imu/assets/main.py b/apps/com.example.imu/assets/main.py new file mode 100644 index 00000000..b246ae1c --- /dev/null +++ b/apps/com.example.imu/assets/main.py @@ -0,0 +1,32 @@ +from machine import Pin, I2C +from qmi8658 import QMI8658 +import time +import machine + + +sensor = QMI8658(I2C(0, sda=machine.Pin(48), scl=machine.Pin(47))) +print(f"""{sensor.temperature=} +{sensor.acceleration=} +{sensor.gyro=}""") + +templabel = lv.label(subwindow) +templabel.align(lv.ALIGN.TOP_MID, 0, 10) + +acclabelx = lv.label(subwindow) +acclabelx.align(lv.ALIGN.CENTER, -100, 0) +acclabely = lv.label(subwindow) +acclabely.align(lv.ALIGN.CENTER, 0, 0) +acclabelz = lv.label(subwindow) +acclabelz.align(lv.ALIGN.CENTER, 100, 0) + +canary = lv.obj(subwindow) +canary.add_flag(0x0001) # LV_OBJ_FLAG_HIDDEN is 0x0001 + +while canary.get_class(): + templabel.set_text(f"Temperature: {sensor.temperature}") + acclabelx.set_text(f"AX: {sensor.acceleration[0]}") + acclabely.set_text(f"AY: {sensor.acceleration[1]}") + acclabelz.set_text(f"AZ: {sensor.acceleration[2]}") + time.sleep_ms(100) + + diff --git a/apps/com.example.imu/res/mipmap-mdpi/launcher_icon.png b/apps/com.example.imu/res/mipmap-mdpi/launcher_icon.png new file mode 120000 index 00000000..ce223be1 --- /dev/null +++ b/apps/com.example.imu/res/mipmap-mdpi/launcher_icon.png @@ -0,0 +1 @@ +../../../../icon_64x64.png \ No newline at end of file