Using GPIO library on Brainy Pi

Brainy Pi GPIO vs Raspberry Pi GPIO

GPIO header Hardware Differences

  1. Pin 26 on BrainyPi is not a GPIO pin while Raspberry Pi is GPIO7.

GPIO header Software Differences

  1. Pins 3 & 4 on Brainy Pi correspond to /dev/i2c-7 while for Raspberry Pi these pins correspond to /dev/i2c-1.
  2. Pins 8 & 10 on Brainy Pi correspond to /dev/ttyS2 while for Raspberry Pi these pins correspond to /dev/ttyS0.
  3. Pins 19, 21, 23, 24, & 26 on Brainy Pi correspond to /dev/spidev0.0 while for Raspberry Pi these pins correspond to /dev/spidev0.0 is using Chip select 0 or /dev/spidev0.1 if using chip select 1.

On Software layer you should be able to use any programmes that use RPi.GPIO without any change. PWM is not fully tested yet. See the examples below:

Example 1: Blinking LED on pin 37

  1. Connect LED and 220 Ohm resistor to pin 37 as per the image below.

  2. Program to Blink LED on pin 37, Save it as gpio-example1.py

    #import the GPIO and time package
    import RPi.GPIO as GPIO
    import time
    
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(37, GPIO.OUT)
    
    # loop through 50 times, on/off for 1 second
    for i in range(50):
        GPIO.output(37,True)
        time.sleep(1)
        GPIO.output(37,False)
        time.sleep(1)
    
    GPIO.cleanup()
    
1 Like