Got GPIO working
authorRaspberry Pi user <pi@njae.me.uk>
Sat, 15 Jun 2013 16:19:47 +0000 (16:19 +0000)
committerRaspberry Pi user <pi@njae.me.uk>
Sat, 15 Jun 2013 16:19:47 +0000 (16:19 +0000)
release/miniband.py

index 2ec376961a533f061784a200efcdd74147a12e5d..641940f4afdb0acfdc01f5fed170f86e96ce0ba7 100755 (executable)
@@ -12,25 +12,36 @@ import struct
 import serial
 import io
 import logging
+import RPi.GPIO as GPIO
 
 PORT = 42001
 DEFAULT_HOST = '127.0.0.1'
 BUFFER_SIZE = 240 #used to be 100
 SOCKET_TIMEOUT = 1
-DEVICES = ['/dev/ttyACM3']
+
+#DEVICES = ['/dev/ttyACM3']
 #DEVICES = ['/dev/ttyACM0', '/dev/ttyACM1','/dev/ttyACM3']
-ARDUINO_BAUD_RATE = 9600
+#ARDUINO_BAUD_RATE = 9600
+
+#BROADCAST_NAMES = {'guitar': 'guitar', 
+#    'drum': {0: 'cymbal',
+#        1: 'hihat',
+#        2: 'slowdrum',
+#        3: 'snare',
+#        4: 'tomtom'},
+#    'maracas': 'maracas'}
 
-BROADCAST_NAMES = {'guitar': 'guitar', 
-    'drum': {0: 'cymbal',
-        1: 'hihat',
-        2: 'slowdrum',
-        3: 'snare',
-        4: 'tomtom'},
-    'maracas': 'maracas'}
+BROADCAST_NAMES = {
+    17: 'maracas',
+    18: 'maracas'}
 
 SENSOR_NAMES = {'guitar': 'guitar_pitch'}
 
+GPIO.setmode(GPIO.BCM)
+for pin in BROADCAST_NAMES:
+    GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
+
+
 logging.basicConfig(level = logging.INFO)
 #logging.basicConfig(level = logging.DEBUG)