Exemple #1
0
import threading
from OSC import OSCClient, OSCServer, OSCMessage
import RPi.GPIO as GPIO

# declare the GPIO pins we're using
LED1 = 2
LED2 = 3
button1 = 4
button2 = 22

# variables for the previous button inputs
previousInput1 = False
previousInput2 = False

# set up the GPIO
GPIO.setmote(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(LED1, GPIO.OUT)
GPIO.setup(LED2, GPIO.OUT)
GPIO.setup(button1, GPIO.IN)
GPIO.setup(button2, GPIO.IN)
# turning on the LEDs is like this:  GPIO.output(LED1, True)

# set up the OSC client (for sending) and server (for receiving)
x32address = ('192.168.1.200', 10023)
client = OSCClient()
client.connect((x32address))
# not sure about these next three lines, check the syntax
server = OSCServer(('localhost', 10023)
server.timeout = 0
run = True