Ejemplo n.º 1
0
import logging
import socket
from time import sleep

# the config and mqtt modules are in a bad place atm :/
import sys
sys.path.append('./mqtt/')
import mqtt
import config

import pysimpledmx
import time

# this is ugly but times are tough
try:
    mydmx = pysimpledmx.DMXConnection("/dev/ttyUSB0")
except:
    logging.info("DMX failed on USB0")
    try:
        mydmx = pysimpledmx.DMXConnection("/dev/ttyUSB1")
    except:
        logging.info("DMX failed on USB1")
        try:
            mydmx = pysimpledmx.DMXConnection("/dev/ttyUSB2")
        except:
            logging.info("DMX failed on USB2")
            try:
                mydmx = pysimpledmx.DMXConnection("/dev/ttyUSB3")
            except:
                logging.info("DMX failed on USB3")
                try:
Ejemplo n.º 2
0
[9] pan/tilt speed
	0 - 2: tracking mode
	3 - 245: fast to slow
	246 - 248: tracking, PtS = SLO
	249 - 251: tracking, PtS = FST
	252 - 255: black out while moving

Currently NOT in a loop, just runs once
"""

import pysimpledmx  # make sure it ais in same home directory
import time

COMport = "/dev/cu.usbserial-ENYXTLPV"  # define COMport number

mydmx = pysimpledmx.DMXConnection(COMport)  # create dmx object

# assuming that we are getting pan angle and tilt angle, make sure we're getting floats!

# with light in upright position, @ tAngle = 45 and pAngle = 210, lamp is parallel to ground, lamp is perpendicular to flat edge

tAngle = float(70.0)
pAngle = float(80.0)

# math for turning "real angles" into DMX values
pAnglePercentage = pAngle / 540
tAnglePercentage = tAngle / 270

pAngleDMX = int(round(pAnglePercentage * 65535))
tAngleDMX = int(round(tAnglePercentage * 65535))
Ejemplo n.º 3
0
        #render_color(keyboard_color.output_color.rgb, 22)
        render_color(keyboard_color.output_color.rgb, 4)
        #render_color(keyboard_color.output_color.rgb, 10)

        #render_color(keyboard_color_1.output_color.rgb, 19)
        #render_color(keyboard_color_1.output_color.rgb, 25)
        #render_color(keyboard_color_1.output_color.rgb, 7)
        render_color(keyboard_color_1.output_color.rgb, 13)

        render_color(drums_color.output_color.rgb, 48)
        # render all dmx channels
        mydmx.render()


# mydmx = pysimpledmx.DMXConnection('/dev/cu.usbserial-6AYP9O1D') # mac dmx com port
mydmx = pysimpledmx.DMXConnection(7)  # windows dmx com port
# mydmx = pysimpledmx.DMXConnection('/dev/ttyUSB0')  # linux com port

# pygame midi initialization
pygame.init()
pygame.midi.init()

# print pygame.midi.get_default_input_id()

# set up queues
stopQ = Queue.Queue()
keyboardQ = Queue.Queue()
drumsQ = Queue.Queue()

keyboard_thread = threading.Thread(name='keyboard',
                                   target=instrument,
Ejemplo n.º 4
0
import pysimpledmx
COMport = "/dev/cu.usbserial-ENYXTLPV"
mydmx = pysimpledmx.DMXConnection(COMport)

mydmx.setChannel(2, 0)
mydmx.setChannel(6, 0) # pan coarse
mydmx.setChannel(7, 0) # pan fine
mydmx.render()

bin(6)
'0b110'
>>> bin(65535)
'0b1111111111111111'
>>> num = bin(65535)
>>> numstr = str(num)
>>> numstr
'0b1111111111111111'
>>> numstr[2:15]
'1111111111111'
>>> numstr = "0b123456789abcdefg"
>>> numstr[1:15]
'b123456789abcd'
>>> numbstr[2:18]

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    numbstr[2:18]
NameError: name 'numbstr' is not defined
>>> numstr[2:18]
'123456789abcdefg'
>>> num = bin(6)
Ejemplo n.º 5
0
    if p[0] == "/dev/ttyUSB0":
        portname[portnumber] = p[0]
        portnumber += 1

    if platform == 'darwin' and p[1].find("DMX USB PRO") != -1:
        portname[portnumber] = p[0]
        portnumber += 1

# ljnozoids.WebStatus("Found " + str(portnumber) +" Nozoids.")

print("Found", portnumber, "DMX devices")

if portnumber > 0:

    print("with serial names", portname)
    mydmx = pysimpledmx.DMXConnection(gstt.serdmx[0])
    senddmx0()
    time.sleep(1)

    # Send a random value to channel 1
    vrand = random.randint(0, 255)
    senddmx(1, vrand)

else:
    mydmx = False
    print("No DMX found, Art-Net receiver only.")

#
# OSC
#
# example
import sys
import random
import time
import os
import fcntl
import pysimpledmx

mydmx = pysimpledmx.DMXConnection(3)
mydmx.setChannel(401, 255)  # set DMX channel 1 to full
Ejemplo n.º 7
0
#!/usr/bin/python
# Python midi to color script
import sys

import pygame
import pygame.midi

import pysimpledmx

import lib

# mydmx = pysimpledmx.DMXConnection('/dev/cu.usbserial-6AYP9O1D') # mac dmx com port
# mydmx = pysimpledmx.DMXConnection(5)  # windows dmx com port
mydmx = pysimpledmx.DMXConnection('/dev/ttyUSB0')  # linux com port

# settings
screen_height = 200
screen_width = 200
no_of_colors = 12
top_key = 84
bottom_key = 36
key_range = top_key - bottom_key
VEL_MAX = 127

# timing
clock = pygame.time.Clock()
FRAMES_PER_SECOND = 60


def clamp(n, minn, maxn):
    return max(min(maxn, n), minn)
Ejemplo n.º 8
0
 def __init__(self):
     self.dmx = pysimpledmx.DMXConnection('/dev/ttyUSB0')
     self.fixture_map = LIGTHS_MAP
Ejemplo n.º 9
0
import pysimpledmx
mydmx = pysimpledmx.DMXConnection("COM11")

#mydmx.setChannel(0, 255)
mydmx.setChannel(1, 255) # set DMX channel 1 to full
#mydmx.setChannel(2, 100) 
mydmx.render()
# set DMX channel 1 to full
mydmx.setChannel(3, 100) 
mydmx.render()
Ejemplo n.º 10
0
import pysimpledmx
import time
mydmx = pysimpledmx.DMXConnection('/dev/cu.usbserial-ALYX7Z1M')
# define color channels
RED = 1
GREEN = 2
BLUE = 3
FOREVER = True
# mydmx.setChannel(1, 255,True) # set DMX channel 1 to full
# mydmx.setChannel(RED, 128, True) # set DMX channel 2 to 128
# mydmx.setChannel(3, 0)   # set DMX channel 3 to 0
# mydmx.render()    # render all of the above changes onto the DMX network

# mydmx.setChannel(4, 255, autorender=True) # set channel 4 to full and render to the network

# if forever is set to true we will loop infinitely
while FOREVER:
    mydmx.setToFire(False)

# mydmx.setToYellow()
# mydmx.fadeDown(BLUE,255,0,2)
# mydmx.fadeUp(RED,0,255,2)