pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit GPS

案例程序

获取本地时间,以及经纬度信息

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
gps_0 = unit.get(unit.GPS, unit.PORTC)

while True:
  print(gps_0.gps_time)
  print(gps_0.latitude)
  print(gps_0.longitude)
  print(gps_0.pos_quality)
  wait_ms(2)

功能说明

gps_0.uart_port_id(1)
  • 设置ID参数
print(gps_0.altitude)
  • 获取海拔高度
print(gps_0.course)
  • 获取道路
print(gps_0.gps_date)
  • 获取GPS数据
print(gps_0.latitude)
  • 获取纬度(string:dddmm.mmmmm)
print(gps_0.latitude_decimal)
  • 获取纬度(string:dd.ddd)
print(gps_0.longitude_decimal)
  • 获取经度(string:dddmm.mmmmm)
print(gps_0.longitude)
  • 获取经度(float:dd.ddd)
print(gps_0.pos_quality)
  • 获取定位精度
print(gps_0.satellite_num)
  • 获取搜星数量
print(gps_0.speed_knot)
  • 获取对地速度
print(gps_0.gps_time)
  • 获取本地时间
gps_0.set_time_zone(0)
  • 设置本地时区
On This Page