RobotStudio event

IF ELSE & Smart Component

Hello, I want to use an if else statement in my Rapid for sch project, 
IF cablecollision=1 THEN
        SetDO PickCable,1;
        MoveL outUsbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        PulseDO PowSync;
        WaitTime 1;
        MoveL LiftusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        WaitTime 1;
        MoveL PickusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        SetDO PickCable,0;
        PulseDO ResetPow;
        WaitTime 1;
        MoveL PressusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        SetDO jerkoffB,1;
        WaitTime 1;
        PulseDO gripperopen;
        SetDO jerkoffB,0;
        WaitTime 2;
        MoveL LiftusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;  
          SetDO Failure,1;
        ELSEIF rj45collision=1 THEN
        dthRJ45;
        SetDO PickCable,1;
        MoveL outUsbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        PulseDO PowSync;
        WaitTime 1;
        MoveL LiftusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        WaitTime 1;
        MoveL PickusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        SetDO PickCable,0;
        PulseDO ResetPow;
        WaitTime 1;
        MoveL PressusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        SetDO jerkoffB,1;
        WaitTime 1;
        PulseDO gripperopen;
        SetDO jerkoffB,0;
        WaitTime 2;
        MoveL LiftusbB,v1000,fine,GripperTCP\WObj:=wobj_cellArea;
        SetDO Failure,1;
        ELSE
        RJ45;
        dthRJ45;
        dthusbB;
        ENDIF

I'm trying to get the simulation to run the part where cablecollision=1 or rj45collision=1. But have been unable to change the value.

The two signals would also run posemover I made in smart component using collision sensor and latching. https://gofile.io/d/Kt7vIU (Thnks for help in adv)


Comments

  • For testing purposes if these are num variables you can set them to 1 in the code before the IF statement as below:
    cablecollision:=1;
  • they are digital inputs signals
  • Either use the inputs/Outputs button on the controller tab to display all I/O and change its value there.
    Or you can create a cross connection from a virtual output signal (have to create this first) to the input signal, then you can set the output signal in the code.
  • I connected each of those to output signals here: https://gofile.io/d/Kt7vIU but still doesn't change?