Esempio n. 1
0
class HazerDmxControl:
    def __init__(self, serialPort):
        self.dmx = DmxPy(serialPort)
        self.hazeChannel = 1
        self.fanChannel = 2

    def _percentToDMXRange(self, percentage):
        return int(round((percentage / 100.0) * 255))

    def _calcAndSend(self, channel, percentage):
        self.dmx.setChannel(channel, self._percentToDMXRange(percentage))
        print("Sending to channel: ", channel, " percentage: ", percentage,
              " dmx range:", self._percentToDMXRange(percentage))
        self.dmx.render()

    def setHazeIntensity(self, hazePercentage):
        self._calcAndSend(self.hazeChannel, hazePercentage)

    def setFanSpeed(self, fanPercentage):
        self._calcAndSend(self.fanChannel, fanPercentage)
Esempio n. 2
0
        Lights.cleanup()
        break  # stops the loop
    else:
        #Turn off the reader until function finishes.
        os.system("/home/pi/Christmas-2015/Scripts/disableRFID.sh")

        Popen(['mpg321', '/home/pi/Christmas-2015/Assets/ChristmasOpener.mp3'],
              stdout=PIPE,
              close_fds=True)

        #Trigger GPIO Pins 33 to turn on project0r. Then wait 30 seconds for the audio to finish
        #Lights.off([37])
        #time.sleep(27)
        #Lights.on({37})

        #Do the DMX thing instead.
        dmx.setChannel(1, 255)
        dmx.setChannel(2, 255)
        dmx.setChannel(3, 255)
        dmx.setChannel(4, 255)
        dmx.render()

        time.sleep(27)
        dmx.setChannel(1, 0)
        dmx.setChannel(2, 0)
        dmx.setChannel(3, 0)
        dmx.setChannel(4, 0)
        dmx.render()

        #Turn the reader back on.
        os.system("/home/pi/Halloween2015/Scripts/enableRFID.sh")
Esempio n. 3
0
dbConn = Logging.Logging()
dmx = DmxPy('/dev/ttyUSB0')

while True:    # Runs until break is encountered. We want to set it to break on a particular ID.
    n = raw_input("Scanned ID: ")
    currentScan = time.time()
    if n == "STOP":
        break  # stops the loop
    else :
        dbConn.logAccess(n)

        #Play Music File
        os.system('mpg321 /home/pi/Python/Assets/christmas.mp3 -q &')

        # Turn On Projectors
        dmx.setChannel(2,255)
        dmx.render()

        # Blink Lights
        count = 0
        while (count < 28):
            dmx.setChannel(1, 255)
            dmx.render()
            time.sleep(.5)
            dmx.setChannel(1, 0)
            dmx.render()
            time.sleep(.5)
            count = count + 1

        # Return Lights to normal. Turn off Projectors
        dmx.setChannel(2,0)
from DmxPy import DmxPy
#import pysimpledmx
import time

dmx = DmxPy('/dev/ttyUSB0')
#dmx = pysimpledmx.DMXConnection(0)
#dmx = pysimpledmx.DMXConnection("/dev/ttyUSB0")
#dmx = DmxPy('COM12')
#dmx.setChannel(0, 100)
#dmx.setChannel(1, 100)
dmx.setChannel(2, 100)
dmx.setChannel(3, 100)
print("motion!")
dmx.render()
time.sleep(2)
dmx.setChannel(3, 100)
time.sleep(2)
dmx.blackout()
dmx.render()
Esempio n. 5
0
import Logging
import os
import time
import random
import signal
from DmxPy import DmxPy
from mutagen.mp3 import MP3

dmx = DmxPy('/dev/ttyUSB0')
TIMEOUT = 300
previousFile = 1
#Turn the reader back on.
os.system("/home/pi/Halloween2015/Scripts/enableRFID.sh")

for x in range (1,62):
    dmx.setChannel(x, 50)
dmx.render()

def interrupted(signum, frame):
    global previousFile
    global dmx

    print 'Nine minutes have passed. Playing files'
    #Log Activation of PI - Disable for now
    #Logging.LogAccess(n)

    #Turn off the reader until function finishes.
    os.system("/home/pi/Halloween2015/Scripts/disableRFID.sh")

    rnd = random.randint(1,4)
    if rnd == 4:
Esempio n. 6
0
from DmxPy import DmxPy
import time

dmx = DmxPy('/dev/ttyUSB0')
dmx.setChannel(1, 100)
dmx.setChannel(2, 50)
dmx.render()
time.sleep(2)
dmx.setChannel(3, 100)
time.sleep(2)
dmx.blackout()
dmx.render()
Esempio n. 7
0
    currentScan = time.time()
    if n == "STOP":
        Lights.cleanup()
        break  # stops the loop
    else :
        #Turn off the reader until function finishes.
        os.system("/home/pi/Christmas-2015/Scripts/disableRFID.sh")

        Popen(['mpg321', '/home/pi/Christmas-2015/Assets/ChristmasOpener.mp3'], stdout=PIPE, close_fds=True)

        #Trigger GPIO Pins 33 to turn on project0r. Then wait 30 seconds for the audio to finish
        #Lights.off([37])
        #time.sleep(27)
        #Lights.on({37})

        #Do the DMX thing instead.
        dmx.setChannel(1, 255)
        dmx.setChannel(2, 255)
        dmx.setChannel(3, 255)
        dmx.setChannel(4, 255)
        dmx.render()

        time.sleep(27)
        dmx.setChannel(1, 0)
        dmx.setChannel(2, 0)
        dmx.setChannel(3, 0)
        dmx.setChannel(4, 0)
        dmx.render()

        #Turn the reader back on.
        os.system("/home/pi/Halloween2015/Scripts/enableRFID.sh")
Esempio n. 8
0
import time
import random
from DmxPy import DmxPy

dmx = DmxPy('/dev/ttyUSB0')

while True:
    for ch1 in range(216, 220):
        ch2 = random.randrange(50, 51)
        ch3 = random.randrange(50, 51)
        ch4 = random.randrange(50, 51)
        dmx.setChannel(0, ch1)
        dmx.setChannel(1, ch2)
        dmx.setChannel(2, ch3)
        print(ch1, ch2, ch3)
        #dmx.setChannel(6, 255)
        dmx.render()
        time.sleep(1.05)