1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix PI gpio to use BCM

This commit is contained in:
Dave Conway-Jones 2017-07-01 22:42:13 +01:00
parent 6201ed4d55
commit dca553048a
No known key found for this signature in database
GPG Key ID: 81B04231572A9A2D

View File

@ -30,7 +30,7 @@ if sys.version_info >= (3,0):
if len(sys.argv) > 2: if len(sys.argv) > 2:
cmd = sys.argv[1].lower() cmd = sys.argv[1].lower()
pin = int(sys.argv[2]) pin = int(sys.argv[2])
GPIO.setmode(GPIO.BOARD) GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False) GPIO.setwarnings(False)
if cmd == "pwm": if cmd == "pwm":
@ -130,7 +130,7 @@ if len(sys.argv) > 2:
elif cmd == "byte": elif cmd == "byte":
#print "Initialised BYTE mode - "+str(pin)+ #print "Initialised BYTE mode - "+str(pin)+
list = [7,11,13,12,15,16,18,22] list = [4,17,27,18,22,23,24,25]
GPIO.setup(list,GPIO.OUT) GPIO.setup(list,GPIO.OUT)
while True: while True:
@ -153,12 +153,12 @@ if len(sys.argv) > 2:
elif cmd == "borg": elif cmd == "borg":
#print "Initialised BORG mode - "+str(pin)+ #print "Initialised BORG mode - "+str(pin)+
GPIO.setup(11,GPIO.OUT) GPIO.setup(17,GPIO.OUT)
GPIO.setup(13,GPIO.OUT) GPIO.setup(27,GPIO.OUT)
GPIO.setup(15,GPIO.OUT) GPIO.setup(22,GPIO.OUT)
r = GPIO.PWM(11, 100) r = GPIO.PWM(17, 100)
g = GPIO.PWM(13, 100) g = GPIO.PWM(27, 100)
b = GPIO.PWM(15, 100) b = GPIO.PWM(22, 100)
r.start(0) r.start(0)
g.start(0) g.start(0)
b.start(0) b.start(0)