收藏

micropython 查看esp32开发板综合信息

分类: 基础知识篇 >> ESP32系统相关 发布于 2024-05-16 363次阅读0点赞0收藏
def sys_stats():
    import os, gc, machine, sys
    from binascii import hexlify
    hwid = str(hexlify(machine.unique_id()))    #Hardware ID
    output = "Hardware ID\t\t"+hwid + '\n'
    uname = os.uname()
    firmwareversion = str(uname.version)
    hardware = uname.machine
    output += "Hardware:\t\t"+hardware+'\n'
    output += "Firmware version:\t"+firmwareversion+'\n'
    mhz = str(machine.freq()/1000000) # Freq in MHz
    freeram = str(gc.mem_free()/1024)    # Free RAM
    usedram = str(gc.mem_alloc()/1024)   # Used RAM
    vfs = os.statvfs('/')
    freedisk = str(vfs[0] * vfs[4]/1024) # Flash VFS size freestr(gc.mem_free()/1024)+"KB"
    output += "Python version:\t\t"+sys.version+'\n'
    output += "CPU Freq:\t\t"+mhz+"MHz\n"
    output += "Memory free:\t\t"+freeram+" KB free\n"
    output += "Memory alloc:\t\t"+usedram+" KB allocated\n"
    output += "Flash:\t\t\t"+freedisk+" KB free\n"
    return(output)

print(sys_stats())
VIP
购买
建议
意见
联系
客服
在线咨询

您可以与在线客服进行沟通获得帮助

工作日:8:00~22:00节假日:9:00~20:00

微信号: mpyos01

Q Q号: 1401211620

免费
福利
0.034275s