mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
parent
335c46ac06
commit
8fe2478a0b
@ -4,6 +4,11 @@
|
||||
import RPi.GPIO as GPIO
|
||||
import sys
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
bounce = 20 # bounce time in mS to apply
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
|
@ -11,7 +11,13 @@
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
import sys
|
||||
import os, select
|
||||
import os
|
||||
import select
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
# Turn off warnings if you run it a second time...
|
||||
GPIO.setwarnings(False)
|
||||
|
@ -4,6 +4,11 @@
|
||||
import RPi.GPIO as GPIO
|
||||
import sys
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
bounce = 20 # bounce time in mS to apply
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
|
@ -8,6 +8,11 @@ import os
|
||||
import subprocess
|
||||
from time import sleep
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
bounce = 25;
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
@ -177,7 +182,7 @@ if len(sys.argv) > 2:
|
||||
elif cmd == "kbd": # catch keyboard button events
|
||||
try:
|
||||
while not os.path.isdir("/dev/input/by-path"):
|
||||
time.sleep(10)
|
||||
sleep(10)
|
||||
infile = subprocess.check_output("ls /dev/input/by-path/ | grep -m 1 'kbd'", shell=True).strip()
|
||||
infile_path = "/dev/input/by-path/" + infile
|
||||
EVENT_SIZE = struct.calcsize('llHHI')
|
||||
|
@ -9,6 +9,11 @@ except ImportError:
|
||||
from neopixel import Adafruit_NeoPixel as PixelStrip, Color
|
||||
__version__ = "legacy"
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
# LED strip configuration:
|
||||
LED_COUNT = 8 # Number of LED pixels.
|
||||
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
|
||||
|
@ -30,6 +30,12 @@ import threading
|
||||
|
||||
from sense_hat import SenseHat
|
||||
|
||||
try:
|
||||
StandardError # Python 2
|
||||
except NameError:
|
||||
StandardError = Exception # Python 3
|
||||
|
||||
|
||||
EVENT_FORMAT = 'llHHI'
|
||||
EVENT_SIZE = struct.calcsize(EVENT_FORMAT)
|
||||
EVENT_NAMES = {103:'U',105:'L',106:'R',108:'D',28:'E'}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Import library functions we need
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import unicornhat as UH
|
||||
@ -64,4 +65,4 @@ while True:
|
||||
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
|
||||
sys.exit(0)
|
||||
except Exception as ex:
|
||||
print "bad data: "+data
|
||||
print("bad data: "+data)
|
||||
|
Loading…
Reference in New Issue
Block a user