diff --git a/hardware/LEDborg/nrgpio.py b/hardware/LEDborg/nrgpio.py index da5213af..d9c301cd 100755 --- a/hardware/LEDborg/nrgpio.py +++ b/hardware/LEDborg/nrgpio.py @@ -6,10 +6,6 @@ import sys bounce = 20 # bounce time in mS to apply -if sys.version_info >= (3,0): - print("Sorry - currently only configured to work with python 2.x") - sys.exit(1) - if len(sys.argv) > 1: cmd = sys.argv[1].lower() pin = int(sys.argv[2]) @@ -17,7 +13,7 @@ if len(sys.argv) > 1: GPIO.setwarnings(False) if cmd == "pwm": - #print "Initialised pin "+str(pin)+" to PWM" + #print("Initialised pin "+str(pin)+" to PWM") GPIO.setup(pin,GPIO.OUT) p = GPIO.PWM(pin, 100) p.start(0) @@ -32,10 +28,10 @@ if len(sys.argv) > 1: GPIO.cleanup(pin) sys.exit(0) except Exception as ex: - print "bad data: "+data + print("bad data: "+data) elif cmd == "buzz": - #print "Initialised pin "+str(pin)+" to Buzz" + #print("Initialised pin "+str(pin)+" to Buzz") GPIO.setup(pin,GPIO.OUT) p = GPIO.PWM(pin, 100) p.stop() @@ -54,10 +50,10 @@ if len(sys.argv) > 1: GPIO.cleanup(pin) sys.exit(0) except Exception as ex: - print "bad data: "+data + print("bad data: "+data) elif cmd == "out": - #print "Initialised pin "+str(pin)+" to OUT" + #print("Initialised pin "+str(pin)+" to OUT") GPIO.setup(pin,GPIO.OUT) if len(sys.argv) == 4: GPIO.output(pin,int(sys.argv[3])) @@ -78,9 +74,9 @@ if len(sys.argv) > 1: GPIO.output(pin,data) elif cmd == "in": - #print "Initialised pin "+str(pin)+" to IN" + #print("Initialised pin "+str(pin)+" to IN") def handle_callback(chan): - print GPIO.input(chan) + print(GPIO.input(chan)) if len(sys.argv) == 4: if sys.argv[3].lower() == "up": @@ -91,7 +87,7 @@ if len(sys.argv) > 1: GPIO.setup(pin,GPIO.IN) else: GPIO.setup(pin,GPIO.IN) - print GPIO.input(pin) + print(GPIO.input(pin)) GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback, bouncetime=bounce) while True: @@ -104,7 +100,7 @@ if len(sys.argv) > 1: sys.exit(0) elif cmd == "byte": - #print "Initialised BYTE mode - "+str(pin)+ + #print("Initialised BYTE mode - "+str(pin)+) list = [7,11,13,12,15,16,18,22] GPIO.setup(list,GPIO.OUT) @@ -127,7 +123,7 @@ if len(sys.argv) > 1: GPIO.output(list[bit], data & mask) elif cmd == "borg": - #print "Initialised BORG mode - "+str(pin)+ + #print("Initialised BORG mode - "+str(pin)+) GPIO.setup(11,GPIO.OUT) GPIO.setup(13,GPIO.OUT) GPIO.setup(15,GPIO.OUT) @@ -154,10 +150,10 @@ if len(sys.argv) > 1: data = 0 elif cmd == "rev": - print GPIO.RPI_REVISION + print(GPIO.RPI_REVISION) elif cmd == "ver": - print GPIO.VERSION + print(GPIO.VERSION) elif cmd == "mouse": # catch mice button events file = open( "/dev/input/mice", "rb" ) @@ -171,7 +167,7 @@ if len(sys.argv) > 1: button = ord( buf[0] ) & pin # mask out just the required button(s) if button != oldbutt: # only send if changed oldbutt = button - print button + print(button) while True: try: @@ -181,4 +177,4 @@ if len(sys.argv) > 1: sys.exit(0) else: - print "Bad parameters - in|out|pwm|buzz|byte|borg|mouse|ver pin {value|up|down}" + print("Bad parameters - in|out|pwm|buzz|byte|borg|mouse|ver pin {value|up|down}") diff --git a/hardware/LEDborg/package.json b/hardware/LEDborg/package.json index f291c0fe..0250c128 100644 --- a/hardware/LEDborg/package.json +++ b/hardware/LEDborg/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-ledborg", - "version" : "0.0.19", + "version" : "0.0.20", "description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.", "dependencies" : { }, diff --git a/hardware/PiLcd/nrlcd.py b/hardware/PiLcd/nrlcd.py index ec6dfc65..622a8c3f 100755 --- a/hardware/PiLcd/nrlcd.py +++ b/hardware/PiLcd/nrlcd.py @@ -107,8 +107,8 @@ def lcd_byte(bits, mode): if len(sys.argv) > 1: pins = sys.argv[1].lower().split(',') if len(pins) != 6: - print "Bad number of pins supplied" - print " "+pins + print("Bad number of pins supplied") + print(" "+pins) sys.exit(0) LCD_RS = int(pins[0]) @@ -181,6 +181,6 @@ if len(sys.argv) > 1: sys.exit(0) else: - print "Bad params" - print " sudo nrlcd.py RS,E,D4,D5,D6,D7" + print("Bad params") + print(" sudo nrlcd.py RS,E,D4,D5,D6,D7") sys.exit(0) diff --git a/hardware/PiLcd/package.json b/hardware/PiLcd/package.json index 2df7e705..e5526eac 100644 --- a/hardware/PiLcd/package.json +++ b/hardware/PiLcd/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pilcd", - "version" : "0.0.9", + "version" : "0.0.10", "description" : "A Node-RED node for Raspberry Pi to write to HD44780 style LCD panels.", "dependencies" : { }, diff --git a/hardware/PiLiter/nrgpio.py b/hardware/PiLiter/nrgpio.py index da5213af..d9c301cd 100755 --- a/hardware/PiLiter/nrgpio.py +++ b/hardware/PiLiter/nrgpio.py @@ -6,10 +6,6 @@ import sys bounce = 20 # bounce time in mS to apply -if sys.version_info >= (3,0): - print("Sorry - currently only configured to work with python 2.x") - sys.exit(1) - if len(sys.argv) > 1: cmd = sys.argv[1].lower() pin = int(sys.argv[2]) @@ -17,7 +13,7 @@ if len(sys.argv) > 1: GPIO.setwarnings(False) if cmd == "pwm": - #print "Initialised pin "+str(pin)+" to PWM" + #print("Initialised pin "+str(pin)+" to PWM") GPIO.setup(pin,GPIO.OUT) p = GPIO.PWM(pin, 100) p.start(0) @@ -32,10 +28,10 @@ if len(sys.argv) > 1: GPIO.cleanup(pin) sys.exit(0) except Exception as ex: - print "bad data: "+data + print("bad data: "+data) elif cmd == "buzz": - #print "Initialised pin "+str(pin)+" to Buzz" + #print("Initialised pin "+str(pin)+" to Buzz") GPIO.setup(pin,GPIO.OUT) p = GPIO.PWM(pin, 100) p.stop() @@ -54,10 +50,10 @@ if len(sys.argv) > 1: GPIO.cleanup(pin) sys.exit(0) except Exception as ex: - print "bad data: "+data + print("bad data: "+data) elif cmd == "out": - #print "Initialised pin "+str(pin)+" to OUT" + #print("Initialised pin "+str(pin)+" to OUT") GPIO.setup(pin,GPIO.OUT) if len(sys.argv) == 4: GPIO.output(pin,int(sys.argv[3])) @@ -78,9 +74,9 @@ if len(sys.argv) > 1: GPIO.output(pin,data) elif cmd == "in": - #print "Initialised pin "+str(pin)+" to IN" + #print("Initialised pin "+str(pin)+" to IN") def handle_callback(chan): - print GPIO.input(chan) + print(GPIO.input(chan)) if len(sys.argv) == 4: if sys.argv[3].lower() == "up": @@ -91,7 +87,7 @@ if len(sys.argv) > 1: GPIO.setup(pin,GPIO.IN) else: GPIO.setup(pin,GPIO.IN) - print GPIO.input(pin) + print(GPIO.input(pin)) GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback, bouncetime=bounce) while True: @@ -104,7 +100,7 @@ if len(sys.argv) > 1: sys.exit(0) elif cmd == "byte": - #print "Initialised BYTE mode - "+str(pin)+ + #print("Initialised BYTE mode - "+str(pin)+) list = [7,11,13,12,15,16,18,22] GPIO.setup(list,GPIO.OUT) @@ -127,7 +123,7 @@ if len(sys.argv) > 1: GPIO.output(list[bit], data & mask) elif cmd == "borg": - #print "Initialised BORG mode - "+str(pin)+ + #print("Initialised BORG mode - "+str(pin)+) GPIO.setup(11,GPIO.OUT) GPIO.setup(13,GPIO.OUT) GPIO.setup(15,GPIO.OUT) @@ -154,10 +150,10 @@ if len(sys.argv) > 1: data = 0 elif cmd == "rev": - print GPIO.RPI_REVISION + print(GPIO.RPI_REVISION) elif cmd == "ver": - print GPIO.VERSION + print(GPIO.VERSION) elif cmd == "mouse": # catch mice button events file = open( "/dev/input/mice", "rb" ) @@ -171,7 +167,7 @@ if len(sys.argv) > 1: button = ord( buf[0] ) & pin # mask out just the required button(s) if button != oldbutt: # only send if changed oldbutt = button - print button + print(button) while True: try: @@ -181,4 +177,4 @@ if len(sys.argv) > 1: sys.exit(0) else: - print "Bad parameters - in|out|pwm|buzz|byte|borg|mouse|ver pin {value|up|down}" + print("Bad parameters - in|out|pwm|buzz|byte|borg|mouse|ver pin {value|up|down}") diff --git a/hardware/PiLiter/package.json b/hardware/PiLiter/package.json index 2b9f059e..cc75478b 100644 --- a/hardware/PiLiter/package.json +++ b/hardware/PiLiter/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-piliter", - "version" : "0.0.12", + "version" : "0.0.13", "description" : "A Node-RED node to drive a Raspberry Pi Pi-LITEr 8 LED board.", "dependencies" : { }, diff --git a/hardware/PiSrf/nrsrf.py b/hardware/PiSrf/nrsrf.py index efb5a1f2..ab0d16d8 100755 --- a/hardware/PiSrf/nrsrf.py +++ b/hardware/PiSrf/nrsrf.py @@ -62,8 +62,8 @@ def restart(): if len(sys.argv) > 1: pins = sys.argv[1].lower().split(',') if len(pins) != 3: - print "Bad parameters supplied" - print pins + print("Bad parameters supplied") + print(pins) sys.exit(0) TRIGGER = int(pins[0]) @@ -91,6 +91,6 @@ if len(sys.argv) > 1: sys.exit(0) else: - print "Bad params" - print " sudo nrsrf.py trigger_pin,echo_pin,rate_in_seconds" + print("Bad params") + print(" sudo nrsrf.py trigger_pin,echo_pin,rate_in_seconds") sys.exit(0) diff --git a/hardware/PiSrf/package.json b/hardware/PiSrf/package.json index 5b865604..7c26ba7f 100644 --- a/hardware/PiSrf/package.json +++ b/hardware/PiSrf/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pisrf", - "version" : "0.1.1", + "version" : "0.1.2", "description" : "A Node-RED node for a Raspberry Pi to use a SRF04 or SRF05 range finder", "dependencies" : { }, diff --git a/hardware/Pibrella/nrgpio.py b/hardware/Pibrella/nrgpio.py index c69a5425..42a8d9b8 100755 --- a/hardware/Pibrella/nrgpio.py +++ b/hardware/Pibrella/nrgpio.py @@ -10,10 +10,6 @@ from time import sleep bounce = 25; -if sys.version_info >= (3,0): - print("Sorry - currently only configured to work with python 2.x") - sys.exit(1) - if len(sys.argv) > 2: cmd = sys.argv[1].lower() pin = int(sys.argv[2]) @@ -21,7 +17,7 @@ if len(sys.argv) > 2: GPIO.setwarnings(False) if cmd == "pwm": - #print "Initialised pin "+str(pin)+" to PWM" + #print("Initialised pin "+str(pin)+" to PWM") GPIO.setup(pin,GPIO.OUT) p = GPIO.PWM(pin, 100) p.start(0) @@ -36,10 +32,10 @@ if len(sys.argv) > 2: GPIO.cleanup(pin) sys.exit(0) except Exception as ex: - print "bad data: "+data + print("bad data: "+data) elif cmd == "buzz": - #print "Initialised pin "+str(pin)+" to Buzz" + #print("Initialised pin "+str(pin)+" to Buzz") GPIO.setup(pin,GPIO.OUT) p = GPIO.PWM(pin, 100) p.stop() @@ -58,10 +54,10 @@ if len(sys.argv) > 2: GPIO.cleanup(pin) sys.exit(0) except Exception as ex: - print "bad data: "+data + print("bad data: "+data) elif cmd == "out": - #print "Initialised pin "+str(pin)+" to OUT" + #print("Initialised pin "+str(pin)+" to OUT") GPIO.setup(pin,GPIO.OUT) if len(sys.argv) == 4: GPIO.output(pin,int(sys.argv[3])) @@ -82,11 +78,11 @@ if len(sys.argv) > 2: GPIO.output(pin,data) elif cmd == "in": - #print "Initialised pin "+str(pin)+" to IN" + #print("Initialised pin "+str(pin)+" to IN") bounce = int(sys.argv[4]) def handle_callback(chan): sleep(bounce/1000) - print GPIO.input(chan) + print(GPIO.input(chan)) if sys.argv[3].lower() == "up": GPIO.setup(pin,GPIO.IN,GPIO.PUD_UP) @@ -95,7 +91,7 @@ if len(sys.argv) > 2: else: GPIO.setup(pin,GPIO.IN) - print GPIO.input(pin) + print(GPIO.input(pin)) GPIO.add_event_detect(pin, GPIO.BOTH, callback=handle_callback, bouncetime=bounce) while True: @@ -108,7 +104,7 @@ if len(sys.argv) > 2: sys.exit(0) elif cmd == "byte": - #print "Initialised BYTE mode - "+str(pin)+ + #print("Initialised BYTE mode - "+str(pin)+) list = [7,11,13,12,15,16,18,22] GPIO.setup(list,GPIO.OUT) @@ -131,7 +127,7 @@ if len(sys.argv) > 2: GPIO.output(list[bit], data & mask) elif cmd == "borg": - #print "Initialised BORG mode - "+str(pin)+ + #print("Initialised BORG mode - "+str(pin)+) GPIO.setup(11,GPIO.OUT) GPIO.setup(13,GPIO.OUT) GPIO.setup(15,GPIO.OUT) @@ -169,7 +165,7 @@ if len(sys.argv) > 2: button = ord( buf[0] ) & pin # mask out just the required button(s) if button != oldbutt: # only send if changed oldbutt = button - print button + print(button) while True: try: @@ -194,7 +190,7 @@ if len(sys.argv) > 2: # type,code,value print("%u,%u" % (code, value)) event = file.read(EVENT_SIZE) - print "0,0" + print("0,0") file.close() sys.exit(0) except: @@ -204,14 +200,14 @@ if len(sys.argv) > 2: elif len(sys.argv) > 1: cmd = sys.argv[1].lower() if cmd == "rev": - print GPIO.RPI_REVISION + print(GPIO.RPI_REVISION) elif cmd == "ver": - print GPIO.VERSION + print(GPIO.VERSION) elif cmd == "info": - print GPIO.RPI_INFO + print(GPIO.RPI_INFO) else: - print "Bad parameters - in|out|pwm|buzz|byte|borg|mouse|kbd|ver|info {pin} {value|up|down}" - print " only ver (gpio version) and info (board information) accept no pin parameter." + print("Bad parameters - in|out|pwm|buzz|byte|borg|mouse|kbd|ver|info {pin} {value|up|down}") + print(" only ver (gpio version) and info (board information) accept no pin parameter.") else: - print "Bad parameters - in|out|pwm|buzz|byte|borg|mouse|kbd|ver|info {pin} {value|up|down}" + print("Bad parameters - in|out|pwm|buzz|byte|borg|mouse|kbd|ver|info {pin} {value|up|down}") diff --git a/hardware/Pibrella/package.json b/hardware/Pibrella/package.json index b7a6cd4e..ebb6bb76 100644 --- a/hardware/Pibrella/package.json +++ b/hardware/Pibrella/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pibrella", - "version" : "0.0.12", + "version" : "0.0.13", "description" : "A Node-RED node to read from and write to a Pibrella Raspberry Pi add-on board", "dependencies" : { }, diff --git a/hardware/neopixel/neopix.py b/hardware/neopixel/neopix.py index 793a1d28..36ea2ae3 100755 --- a/hardware/neopixel/neopix.py +++ b/hardware/neopixel/neopix.py @@ -171,5 +171,5 @@ if __name__ == '__main__': except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program sys.exit(0) except Exception as ex: - print "bad data: "+data - print ex + print("bad data: "+data) + print(ex) diff --git a/hardware/neopixel/package.json b/hardware/neopixel/package.json index 44a67678..85b1b882 100755 --- a/hardware/neopixel/package.json +++ b/hardware/neopixel/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pi-neopixel", - "version" : "0.0.19", + "version" : "0.0.20", "description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.", "dependencies" : { },