Saturday, October 16, 2021

CircuitPython 7.0.0 run on Raspberry Pi Pico RP2040

 CircuitPython 7.0.0 run on Raspberry Pi Pico RP2040:

"""
CircuitPython 7 exercise run on Raspberry Pi Pico PR2040,
get system info.
"""
import board
import sys
import os
import microcontroller
# ref:
# The entire table of ANSI color codes working in C:
# https://gist.github.com/RabaDabaDoba/145049536f815903c79944599c6f952a
class color:
   RED = '\033[1;31;48m'
   BLUE = '\033[1;34;48m'
   BLACK = '\033[1;30;48m'
   END = '\033[1;37;0m'

print(board.board_id)
print(sys.implementation[0] + ' ' +
      str(sys.implementation[1][0]) +'.'+
      str(sys.implementation[1][1]) +'.'+
      str(sys.implementation[1][2]))
print("=====================================")
info = color.RED + \
       sys.implementation[0] + ' ' + \
       os.uname()[3] + color.END + '\n' + \
       'run on ' + color.BLUE + os.uname()[4] + color.END
print(info)
print("=====================================")
print("with number of cpu: " + color.RED +
      str(len(microcontroller.cpus)) + color.RED)

print()

To install CircuitPython firmware on Raspberry Pi, read the HERE.


No comments: