Apart from reading the internal temperature sensor and frequency, is there any other useful information you can query on the Pico board using Micropython?
For example, memory or flash usage, CPU usage etc.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityApart from reading the internal temperature sensor and frequency, is there any other useful information you can query on the Pico board using Micropython?
For example, memory or flash usage, CPU usage etc.
Memory usage can be measured in the same way as ordinary Python, using gc.alloc()
and gc.free()
.
Flash usage likewise be measured using os.statvfs('/')
.
I'm not aware of any way of getting the CPU usage. The only thing that comes to mind is machine.freq()
, which will tell you the CPU frequency.
You can test these with:
import gc
import os
import machine
s = os.statvfs('/')
print(f"Free storage: {s[0]*s[3]/1024} KB")
print(f"Memory: {gc.mem_alloc()} of {gc.mem_free()} bytes used.")
print(f"CPU Freq: {machine.freq()/1000000}Mhz")
It's worth having a look through the MicroPython libraries docs as there may be other hidden gems there.