Example #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)
Example #2
0
__author__ = 'madsens'

import Lights
import time
from subprocess import Popen, PIPE
import os
from DmxPy import DmxPy

# This code runs the Dining Room

dmx = DmxPy('/dev/ttyUSB0')
lastScan = 0
Lights.setup()

#Turn the reader back on.
os.system("/home/pi/Christmas-2015/Scripts/enableRFID.sh")

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":
        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)
Example #3
0
#!/usr/bin/env python

from DmxPy import DmxPy

# print "dmxtest started"
global dmx
dmx = DmxPy('/dev/ttyUSB0')


#Main Code
def Main():

    #globals
    global dmx

    # Color Code:
    # 1. Red
    # 2. Orange
    # 3. Amber
    # 4. Green
    # 5. Cyan
    # 6. Blue
    # 7. Indigo
    # 8. Intensity

    #Channels ending in 8 are intensities
    #Channels ending in 1 are red
    #Channels ending in 6 are blue

    RED = 0
    BLUE = 255
Example #4
0
#!/usr/bin/python
__author__ = 'madsens'
# Hall of Fame gag. Will run laser show, 10 DJ lights and play sound.

import time, sys, os
sys.path.append("/home/pi/PiClasses")
import Logging, GPIOLib
from termios import tcflush, TCIOFLUSH
from DmxPy import DmxPy
from random import randint

#Instantiate Logging and DMX Classes
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
Example #5
0
 def __init__(self, serialPort):
     self.dmx = DmxPy(serialPort)
     self.hazeChannel = 1
     self.fanChannel = 2
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()
Example #7
0
__author__ = 'madsens'
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)
Example #8
0
import time
import random
import flask
from DmxPy import DmxPy


def show(msg, timeout=1):
    for t in range(timeout * 60):
        j = 0
        for i in msg:
            dmx.setChannel(j, i)
            j = j + 1
        dmx.render()
        time.sleep(0.1)


dmx = DmxPy('/dev/ttyUSB1')
Example #9
0
  disp.map("/sean/alpha",       mindwave_handler, sharedMindState, "a")
  disp.map("/sean/beta",       mindwave_handler, sharedMindState, "b")
  #disp.map("/sean/alphaavg",       mindwave_handler, sharedMindState, "a")
  #disp.map("/sean/betaavg",       mindwave_handler, sharedMindState, "b")
  disp.map("/sean/phase", mindwave_handler, sharedMindState, "program")

  disp.map("/mindwave/1/boot",     mindwave_handler_state, sharedMindState, MW_BOOT)
  disp.map("/mindwave/1/scanning", mindwave_handler_state, sharedMindState, MW_SCANNING)
  disp.map("/mindwave/1/denied",   mindwave_handler_state, sharedMindState, MW_DENIED)
  client = UDPClient(args.ip, args.port)
  send_settings(client, setting)

  dmx = None
  try:
      dmx = DmxPy('/dev/serial/by-id/usb-DMXking.com_DMX_USB_PRO_6AYP9P66-if00-port0')
  except:
      print("no dmx")

  server = osc_server.ThreadingOSCUDPServer((args.ip, args.port), disp)
  # handlers for settings
  disp.map("/led/settings", setting_request_handler, client, setting)
  disp.map("/led/settings/timeout", setting_handler, server, setting, "timeout")
  disp.map("/led/settings/updates", setting_handler, server, setting, "ups")
  disp.map("/led/settings/change", setting_handler, server, setting, "change")
  disp.map("/led/settings/leds", setting_handler_restart, server, setting, "leds")
  disp.map("/led/settings/satlimit", setting_handler, server, setting, "satlimit")
  disp.map("/led/settings/value", setting_handler, server, setting, "value")

  if dmx is not None:
      disp.map("/strobe/1", strobe_handler, dmx)
Example #10
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()
Example #11
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)