Python/Raspberry Pi to read model name
Python code run on Raspberry Pi to get model name, by reading
/proc/device-tree/model.
"""
Python run on Raspberry Pi to get model name
"""
def read_f(file):
print(file, ":")
with open(file, encoding='UTF-8') as reader:
content = reader.read()
return content
print(read_f("/proc/device-tree/model"))
Output run on Raspberry Pi 5/8G running Raspberry Pi OS 64-bit (bookworm).
/proc/device-tree/model :
Raspberry Pi 5 Model B Rev 1.0
Comments
Post a Comment