Looping group outputs

  • Hi all. I am working with a program, which has quite many group outputs for sending data from the robot to PLC. It is quite painful to keep setting and resetting the outputs all the time, so I was wondering that is it possible to simplify this with a for loop.


    I have something like this.

    Code
    VAR num outputBuffer{30};
    
    
    SetGO go1,outputBuffer{1};
    SetGO go2,outputBuffer{2};
    SetGO go3,outputBuffer{3};
    ....
    SetGO go30,outputBuffer{30};


    Would it be possible to somehow loop it like this?

    Code
    FOR i FROM 1 TO Dim(outputBuffer,1) DO
            go<i> := outputBuffer{i};
    ENDFOR
  • to use signals as a array you have to first declare a array of signals and attach to your signals, like this:

Advertising from our partners