Adsense HTML/JavaScript

Tuesday, August 11, 2020

microPython exercise (ESP32): get system info

The uos module contains functions for filesystem access and mounting, terminal redirection and duplication, and the uname and urandom functions. Its uname() function return a tuple containing information about the underlying machine and/or its operating system. The tuple has five fields in the following order, each of them being a string:

  • sysname – the name of the underlying system
  • nodename – the network name (can be the same as sysname)
  • release – the version of the underlying system
  • version – the MicroPython version and build date
  • machine – an identifier for the underlying hardware (eg board, CPU)

Example, sysinfo.py

import uos

uname = uos.uname()
print(uname)
print("sysname: " + uname.sysname)
print("nodename: " + uname.nodename)
print("release: " + uname.release)
print("version: " + uname.version)
print("machine: " + uname.machine)


No comments:

Post a Comment