How to make tower light flash

How do you make your light flash to show green flashing on tower light with Universal Robot?

Tie an output from the robot to the ON input of your green light. Then use a Thread like so:

image

1 Like

Interesting idea. Hadn’t though of that. You could create logic that sends various signals to the light based on what the robot does. :+1:

I made a script that can flash any DO or CO at a variable rate. It ends up looking something like:

image

The second parameter is kinda weird, in that it’s a binary position of an integer, not a “period in seconds” type of thing. So for example, putting in a 2 flashes it twice as slow as 1, and 3 is twice as slow as 2, and so on. I’m sure it can be modified to take seconds as the argument instead, but it was a pretty elegant solution for me, since I just needed a “flash fast or slow” type thing.

Found it on my computer, so I’ll include it below. As with most of what I write, I barely remember what I was doing at the time, I just know the functions do what they say lol.

enableDOFlash = [False,False,False,False,False,False,False,False]
DOFlashRate = [0,0,0,0,0,0,0,0]

enableCOFlash = [False,False,False,False,False,False,False,False]
COFlashRate = [0,0,0,0,0,0,0,0]

def startFlashDO(outputNumber, rate):
  enableDOFlash[outputNumber] = True
  DOFlashRate[outputNumber] = rate
end

def stopFlashDO(outputNumber):
  enableDOFlash[outputNumber] = False
  set_standard_digital_out(outputNumber, False)
end

def startFlashCO(outputNumber, rate):
  enableCOFlash[outputNumber] = True
  COFlashRate[outputNumber] = rate
  set_configurable_digital_out(outputNumber, False)
end

def stopFlashCO(outputNumber):
  enableCOFlash[outputNumber] = False
end
thread flasher():
  count = 0
  while(True):
    global flashArray = integer_to_binary_list(floor(count))
    i = 0
    count = count + 1/500
    if(count >= 50000):
      count = 0
    end
    while(i <= 7):
      if(enableDOFlash[i]):
        DOflashIndex = DOFlashRate[i]
        set_digital_out(i, flashArray[DOFlashRate[i]])
      end
      if(enableCOFlash[i]):
        COflashIndex = COFlashRate[i]
        set_configurable_digital_out(i, flashArray[COFlashRate[i]])
      end
      i = i + 1
    end
  end
end
2 Likes