From: Raspberry Pi user Date: Sat, 15 Jun 2013 16:19:47 +0000 (+0000) Subject: Got GPIO working X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=d1a8c6405a615e90a733b39927f846dc9236119b;p=miniband.git Got GPIO working --- diff --git a/release/miniband.py b/release/miniband.py index 2ec3769..641940f 100755 --- a/release/miniband.py +++ b/release/miniband.py @@ -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)