#!/usr/bin/env python # Copyright 2016 by Andrew Laughton under the gpl ver 3.0. http://www.gnu.org/licenses/gpl-3.0.en.html # This file is to be used from the command line to read the state of the pins. # It sets up the Raspberry Pi General purpose In Out (GPIO) pins to suit the wiring to the relay board. import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) #Option is BCM This hopefully gives the header pin number. GPIO.setwarnings(False) pin1 = 38 pin2 = 36 pin3 = 32 pin4 = 26 pin5 = 24 pin6 = 22 pin7 = 16 pin8 = 12 # setup pins as outputs GPIO.setup(pin1,GPIO.OUT) #GPIO GPIO.setup(pin2,GPIO.OUT) #GPIO GPIO.setup(pin3,GPIO.OUT) #GPIO GPIO.setup(pin4,GPIO.OUT) #GPIO GPIO.setup(pin5,GPIO.OUT) #GPIO GPIO.setup(pin6,GPIO.OUT) #GPIO GPIO.setup(pin7,GPIO.OUT) #GPIO GPIO.setup(pin8,GPIO.OUT) #GPIO state = GPIO.input(pin1) print "Zone 1, pin %d is now " % pin1 + str(state) state = GPIO.input(pin2) print "Zone 2, pin %d is now " % pin2 + str(state) state = GPIO.input(pin3) print "Zone 3, pin %d is now " % pin3 + str(state) state = GPIO.input(pin4) print "Zone 4, pin %d is now " % pin4 + str(state) state = GPIO.input(pin5) print "Zone 5, pin %d is now " % pin5 + str(state) state = GPIO.input(pin6) print "Zone 6, pin %d is now " % pin6 + str(state) state = GPIO.input(pin7) print "Zone 7, pin %d is now " % pin7 + str(state) state = GPIO.input(pin8) print "Zone 8, pin %d is now " % pin8 + str(state)