May 18, 2024, 06:32:20 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Using DMX as a Prop Trigger

Started by JonnyMac, April 17, 2012, 11:57:59 AM

Previous topic - Next topic

JonnyMac

April 17, 2012, 11:57:59 AM Last Edit: April 17, 2012, 06:50:20 PM by JonnyMac
Big amusement parks do it, so why shouldn't you?  Perhaps you have a display that involves a lot of lighting and uses a DMX master to control the show.  Wouldn't be cool to listen to a DMX channel and use that as a trigger for a local prop program?  Well now you can.

It's really easy.  With the HC-8+ you simply install the DMX receiver and then compare the DMX address switch to the channel you want to monitor.  If the value of that channel meets your trigger point (constant called TRIGGER in my program) then you run the prop code.  Easy peazy.

Here's a simple chaser that runs when the DMX channel hits or exceeds 250. 

Edit: I decided to have a bit more fun and used the two channels that follow the address in the chaser sequence.  The next value (address + 1) sets the "on" brightness for the LEDs, the channel that follows that (address + 2) sets the chase speed.  There you go: a DMX controlled animation!

pub main | myaddr, ch

  setup_io                                                      ' setup HC-8+ IO pins

  leds.start(8, OUT0)                                           ' start LED driver       
 
  set_rs485(RX)                                                 ' set RS-485 for receive
  dmx.start(RX2, G_LED, 1000)                                   ' start DMX, green LED = activity
  low(R_LED)                                                    ' required for green LED

  pause(1)                                                      ' let all cogs start
 
  repeat
    myaddr := dmx_address(true)                                 ' scan DMX address switch
    if (myaddr > 0)                                             ' valid?
      if (dmx.read(myaddr) => TRIGGER)                          ' trigger level on channel?
         
        ' prop code here
        ' -- chaser demo

        repeat ch from 0 to 7                                   ' loop through outputs
          leds.set(ch, dmx.read(myaddr+1))                      ' led brightness (use address + 1)
          pause(50 #> dmx.read(myaddr+2) <# 250)                ' set speed (use address + 2)
          leds.low(ch)                                          ' led off
Jon McPhalen
EFX-TEK Hollywood Office