Created
August 2, 2023 07:15
-
-
Save aldodelgado/c476e224c942a5bf81225aaa81ed3166 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import os | |
| import platform | |
| import time | |
| import gc | |
| import micropython | |
| import board | |
| import microcontroller | |
| def print_board_info(): | |
| print("=== Board Information ===") | |
| print(f"Board: {platform.platform()}") | |
| print(f"Python Version: {sys.version}") | |
| print(f"CircuitPython Version: {sys.implementation.version}") | |
| print(f"Microcontroller: {microcontroller.cpu}") | |
| print(f"Frequency: {microcontroller.cpu.frequency / 1000000} MHz") | |
| print(f"Board ID: {board.board_id}") | |
| def print_memory_info(): | |
| print("\n=== Memory Information ===") | |
| print(f"Total RAM: {microcontroller.memory.total_bytes} bytes") | |
| print(f"Free RAM: {gc.mem_free()} bytes") | |
| print(f"Allocated RAM: {gc.mem_alloc()} bytes") | |
| def print_filesystem_info(): | |
| print("\n=== Filesystem Information ===") | |
| try: | |
| files = os.listdir("/") | |
| print("Files in root directory:") | |
| for file in files: | |
| print(f" - {file}") | |
| except OSError as e: | |
| print(f"Error accessing the filesystem: {e}") | |
| def print_sensor_info(): | |
| print("\n=== Sensor Information ===") | |
| # Add any sensor-specific code here to print their information | |
| # For example, if you have a temperature sensor connected: | |
| # import adafruit_dht | |
| # dht = adafruit_dht.DHT22(board.D4) | |
| # temperature = dht.temperature | |
| # humidity = dht.humidity | |
| # print(f"Temperature: {temperature} °C") | |
| # print(f"Humidity: {humidity} %") | |
| def main(): | |
| print_board_info() | |
| print_memory_info() | |
| print_filesystem_info() | |
| print_sensor_info() | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment