Tutorial

Table Of Contents
80
def run(self):
'''
Functions for multi-threaded tasks
'''
while 1:
self.__flag.wait()
self.lightChange()
pass
if __name__ == '__main__':
RL=RobotLight() # Instantiate the object that controls the LED light
RL.start() # Start thread
'''
Start breathing light mode and stop after 15 seconds
'''
RL.breath(70,70,255)
time.sleep(15)
RL.pause()
'''
Pause for 2 seconds
'''
time.sleep(2)
'''
Start the police light mode and stop after 15 seconds
'''
RL.police()
time.sleep(15)
RL.pause()
14.3 Warning Lights or Breathing Lights in Other Projects
When your project needs to use LED lights for warning lights or breathing lights, you don’t need to
rewrite the above code, just copy robotLight.py in the robot program server folder to the same In the folder,
then use the following code to use the warning light or breathing light:
import robotLight