DMX Board

From ETC Public Wiki
Jump to: navigation, search


The following code was written on Windows 7 using Unity 4.6.1f1 and tested with both an Enttec DMX USB Pro and the newer Enttec DMX USB Pro Mk2. Please refer to the Enttec web site for documentation specific to to each model DMX controller. In particular, you will to install the FTDI D2XX Direct Driver to get the Virtual COM Port (VCP) functionality required for this software to work.

Determine DMX COM Port Number

NOTE: Start with your DMX controller unplugged

  1. Download and install the DMX driver per the user manual.
  2. Open Device Manager.
    On Windows 7: Right click Computer | choose Manage | select Device Manager
  3. Expand Ports (COM & LPT)
  4. Make note of which COM ports currently exist
  5. Plug the DMX controller into your computer
  6. Find the newly installed COM port in the Device Manager
    It should appear as USB Serial Port (COMnn) where nn = a number, e.g. COM23

Enable Support for System.IO.Ports Namespace

  1. Open your Unity project
  2. Open Edit | Project Settings | Player
  3. Click the <downarrow> icon to select Settings for PC, Mac & Linux Standalone
  4. Expand Other Settings
  5. Set Api Compatibility Level to .NET 2.0

NOTE: The default setting is .NET 2.0 Subset which does not include support for System.IO.Ports.

Using the DMX Class

Add DMX.cs to your Unity project. Make sure you include the ETC.Platforms namespace in any script referencing the DMX class.

using UnityEngine;
using System.Collections;
using ETC.Platforms;

public class DmxExample : MonoBehaviour {
	private DMX dmx;

	Start () {
		this.dmx = new DMX("COM23");
		this.dmx.Channels[1] = 255;
		this.dmx.Channels[2] = 255;
		this.dmx.Channels[3] = 255;

Source Code

Example project with source code