Created
September 29, 2013 19:43
-
-
Save felixlindemann/6755819 to your computer and use it in GitHub Desktop.
test pi
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
from time import sleep | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BOARD) | |
gpios = { | |
1: "3.3 v", | |
2: "5.5 v", | |
3: "GPIO 0 (SDA)", | |
4: "5.5 v", | |
5: "GPIO 1 (SCL)", | |
6: "Ground", | |
7: "GPIO 4 (GPCLK0)", | |
8: "GPIO 14 (TXD)", | |
9: "Ground", | |
10: "GPIO 15 (RXD)", | |
11: "GPIO 17", | |
12: "GPIO 18 (PCM_CLK)", | |
13: "GPIO 21 (PCM_DOUT)", | |
14: "Ground", | |
15: "GPIO 22", | |
16: "GPIO 23", | |
17: "3.3 v", | |
18: "GPIO 24", | |
19: "GPIO 10 (MOSI)", | |
20: "Ground", | |
21: "GPIO 9 (MISO)", | |
22: "GPIO 25", | |
23: "GPIO 11 (SCLK)", | |
24: "GPIO 8 (CE0)", | |
25: "Ground", | |
26: "GPIO 7 (CE1)" | |
} | |
usedgpios = [3,5,7,11,12,13,15,16,18,19,21,22,23,24,26] | |
for i in usedgpios: | |
print('Setting up Input ',i) | |
GPIO.setup(i,GPIO.IN) | |
# state - decides what LED should be on and off | |
state = 0 | |
# increment - the direction of states | |
inc = 1 | |
while True: | |
for i in usedgpios: | |
if GPIO.input(i): | |
print(gpios[i], ' was HIGH') | |
sleep(0.2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment