Wednesday, February 23, 2022

Raspberry Pi Pico/MicroPython: get MicroPython version programmatically

A simple exercise run on Raspberry Pi Pico/MicroPython to get installed MicroPython version programmatically.


mpyPico_info.py

import uos
import usys

class color:
    BLACK =   '\033[1;30;48m'
    RED =     '\033[1;31;48m'
    GREEN =   '\033[1;32;48m'
    YELLOW =  '\033[1;33;48m'
    BLUE =    '\033[1;34;48m'
    MAGENTA = '\033[1;35;48m'
    CYAN =    '\033[1;36;48m'
    END =    '\033[1;37;0m'

#print(uos.uname())
#print(usys.implementation)

print("====================================================")
print(color.BLUE, usys.implementation[0],
      str(usys.implementation[1][0]) + "." +
      str(usys.implementation[1][1]) + "." +
      str(usys.implementation[1][2]), color.END)
print(uos.uname()[3])
print("run on", color.RED, uos.uname()[4], color.END)
print("====================================================")





~ more exercises for Raspberry Pi Pico

No comments: