apc40 direct dmx control

Discussion in 'PangoScript, Universe and Midi Templates' started by stok, Sep 15, 2015.

  1. stok

    stok Member


    I like to switch between 0 and 255 with severall DMX channels directly from a APC40 without using the main grid or secondary grid. I can set the DMX by midi settings and then "Tone ON" but I cant seem to get a toggle working there. It gives a error message even if I use a copy code which is working good somewhere else in the program. It seems I can't use any IF statements there. So now if I push a apc40 button I can only set a dmx channel to 255 once but I cannot set it back to 0 with a toggle principle.

    Is there any way to do this without main and seconday grid?

    I like to have a thirth MIDI controller just for fixed DMX values thats why I like to have this.

  2. stok

    stok Member


    Thanks for youre reply-@

    I have it working.
    I'm doing the setting of at MIDI controller settings and then at "ToneON"
    2 causes why it didnt work:

    1)first i tried this
    I used a if statement with value. If (value>0.5) then goto.... This is not working.

    2) second I tried this
    I liked to use the function TOGGLE but that seems also not to work in this setting

    So now I made a global var of which I set the toggle value myself
    Globalvar DMXmidi1

    if (DMXmidi1>0) goto startprocess
    dmxout 1,255


    So this way I can toggle dmx channel 1 between 0 and 255 without using the maingrid or secondary grid. So i created a thirt virtual grid. Iwill do the visualisation with universe.

    Now I like to set the color of the APC40 button1 by
    midiout 0x90,0x3E,0x7F

    But when I do this at "ToneON" of the dedicated controller settings it does not do anything. If I set this setting at button2 it works but button1 is acting(thats normal because I used 0x90 and that is button1). I can't get the button to light which is pushed.

    Push button1, light Button 1 - but Push button1 light button2 works

    Did not have enough time so I will continue tomorrow
    Last edited: Sep 16, 2015
  3. ENOT

    ENOT Software Developer Staff Member

    The simplest way to map MIDI slider to DMX OUT require one line of code.

    DmxOut 10, param(3)*2

    where 10 is a number of DMX output channel, param(3) is 3rd byte of MIDI message, and 2 is a scale. MIDI controller value has range 0..127. After multiplication on 2 we have 0..254 range, almost DMX range.

    If you have MIDI button that sent Control Change messages then code may be like that:

    if (param(3) > 64) DmxOut 10, 255
    if (param(3) <= 64) DmxOut 10, 0

    If you have MIDI button that sent Note On and Note Off, then you need two scripts, one for Note On and Note Off. In both cases it will be one DmxOut command.

    Best Regards,