Tuesday, August 11, 2015

Get Raspberry Pi Board Information in Python + RPi.GPIO

Example to discover information about your Raspberry Pi Board, with GPIO.RPI_INFO introduced since 0.5.10.
(reference: http://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/)

import sys
import RPi.GPIO as GPIO

print(sys.version)
print("GPIO.VERSION: " + GPIO.VERSION)
print("GPIO.RPI_REVISION (deprecated): " + str(GPIO.RPI_REVISION))

print("")
print("GPIO.RPI_INFO:")
print(GPIO.RPI_INFO)

print("")
for keys,values in GPIO.RPI_INFO.items():
    print(keys + " : " + str(values))


Run on Python 2.7.3 + RPi.GPIO 0.5.11

Run on Python 3.2.3 + RPi.GPIO 0.5.11

No comments: