0

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.

1
  • No one but you can know which information you think is useful. You need to read the documentation.
    – joan
    Feb 1 at 15:33

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.