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,12 +30,12 @@ if sys.version_info >= (3,0):
if len(sys.argv) > 2:
cmd = sys.argv[1].lower()
pin = int(sys.argv[2])
GPIO.setmode(GPIO.BOARD)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
if cmd == "pwm":
#print "Initialised pin "+str(pin)+" to PWM"
try:
try:
freq = int(sys.argv[3])
except:
freq = 100
@ -130,7 +130,7 @@ if len(sys.argv) > 2:
elif cmd == "byte":
#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)
while True:
@ -153,12 +153,12 @@ if len(sys.argv) > 2:
elif cmd == "borg":
#print "Initialised BORG mode - "+str(pin)+
GPIO.setup(11,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(15,GPIO.OUT)
r = GPIO.PWM(11, 100)
g = GPIO.PWM(13, 100)
b = GPIO.PWM(15, 100)
GPIO.setup(17,GPIO.OUT)
GPIO.setup(27,GPIO.OUT)
GPIO.setup(22,GPIO.OUT)
r = GPIO.PWM(17, 100)
g = GPIO.PWM(27, 100)
b = GPIO.PWM(22, 100)
r.start(0)
g.start(0)
b.start(0)