pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Atomic GPS

Example

Retrieves and prints time, latitude, longitude, and altitude data to the serial port.

from m5stack import *
from m5ui import *
from uiflow import *
from base.GPS import GPS
import time

gps.deinit()
while True:
  print(gps.timestamp)
  print(gps.latitude)
  print(gps.longitude)
  print(gps.altitude)
  wait(2)
  wait_ms(2)

API

gps.deinit()
  • Deinitializes the GPS module, releasing resources.
gps = GPS(0, '')
  • Initializes the GPS module and sets the timezone.
    • timezone specifies the time offset.
    • formatting specifies the time format.
gps._tf.init_sdcard(33, 19, 23, 20000000)
  • Configures the SD card communication pins and SPI frequency, specifying MISO (Pin 33), MOSI (Pin 19), SCK (Pin 23), and frequency (20000000Hz).
gps.altitude
  • Retrieves altitude data from the GPS module.
gps.course
  • Retrieves the current course (direction of travel) from the GPS module.
gps.date
  • Retrieves the current date from the GPS module.
gps.geoid_height
  • Retrieves the geoid height at the current position.
gps.hdop
  • Retrieves the horizontal dilution of precision (HDOP), representing GPS positioning accuracy.
gps.last_sv_sentence
  • Retrieves the last received satellite visibility (SV) sentence, typically used for debugging GPS signal.
gps.latitude
  • Retrieves the current latitude value.
gps.longitude
  • Retrieves the current longitude value.
with open('/sd/', 'a')
  pass
  • Opens a file on the SD card in the specified mode. path specifies the file path, mode specifies the mode (e.g., read, write, append).
passprint(gps.pdop)
  • Retrieves the position dilution of precision (PDOP), indicating positioning accuracy.
gps.satellites_in_use
  • Retrieves the number of satellites currently in use for positioning.
gps.satellites_in_view
  • Retrieves the number of satellites currently in view, representing all detected satellites.
gps.satellites_used
  • Retrieves the number of satellites actually used for positioning.
gps.satellite_data
  • Retrieves current satellite data from the GPS module.
fs.tell()
  • Retrieves the current position of the read pointer in a file.
fs.read(0)
  • Reads a specified number of bytes from a file.
fs.read()
  • Reads all content from a file.
fs.readline()
  • Reads one line of data from a file.
fs.seek(0)
  • Sets the file read pointer position.
fs.write('')
  • Writes specified text to a file.
gps._tf.is_folder_exist('')
  • Checks if a folder exists at the specified path.
gps._tf.is_file_exist('')
  • Checks if a file exists at the specified path.

<img class="blockly_svg" src="https

://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/static/assets/img/uiflow/blockly/atomic_base/gps/uiflow_block_base_gps_sdcard_listdir.svg">

gps._tf.show_directory('')
  • Displays the list of files and folders at the specified path.
gps._tf.create_folder('')
  • Creates a new folder at the specified path.
gps._tf.delete_file('')
  • Deletes a file at the specified path.
gps._tf.rename_file('', '')
  • Renames a file from the old path to a new path.
gps._tf.delete_folder('')
  • Deletes a folder at the specified path.
gps.speed
  • Retrieves current speed data from the GPS module.
gps.timestamp
  • Retrieves the current timestamp, typically acquired from satellite signals.
gps.total_sv_sentence
  • Retrieves the total count of satellite visibility (SV) sentences.
gps.vdop
  • Retrieves the vertical dilution of precision (VDOP), indicating vertical positioning accuracy.
On This Page