forked from jradwan/pidp11-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleds-off.py
executable file
·44 lines (35 loc) · 1.16 KB
/
leds-off.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# LEDs-Off
# Jeremy C. Radwan
# March 14, 2019
#
# This simple Python script loops through the GPIO pins that control the
# PiDP-11's 6 LED rows and 12 LED columns and toggles them appropriately
# to turn off all of the LEDs. Useful for "clearing" the front panel of any
# "stuck" LEDs after exiting from simh.
#
# Modification History:
#
# (05/18/2019, JCR) - corrected GPIO/pin confusion in ledrows and ledcols
# arrays; consolidated GPIO statements
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
print "\nTurning off all PiDP-11 LEDs ...\n"
# ledrows (xled0-5) associated gpio pins
ledrows = [20, 21, 22, 23, 24, 25]
# turn off ledrows
rowcount = 0
for row in ledrows:
print "Turning off xled" + str(rowcount) + " (pin " + str(row) + ")"
rowcount = rowcount + 1
GPIO.setup(row, GPIO.OUT, initial = GPIO.LOW)
print ""
# ledcols (col0-11) associated gpio pins
ledcols = [26, 27, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
# turn off ledcols
colcount = 0
for col in ledcols:
print "Turning off col" + str(colcount) + " (pin " + str(col) + ")"
colcount = colcount + 1
GPIO.setup(col, GPIO.OUT, initial = GPIO.HIGH)
print "\nDone!\n"