Tutorial

Table Of Contents
78
'''
Call this function to turn on the police light mode
'''
self.lightMode = 'police'
self.resume()
def policeProcessing(self):
'''
The specific realization of the police light mode
'''
while self.lightMode == 'police':
'''
Blue flashes 3 times
'''
for i in range(0,3):
self.setSomeColor(0,0,255,[0,1,2,3,4,5,6,7,8,9,10,11])
time.sleep(0.05)
self.setSomeColor(0,0,0,[0,1,2,3,4,5,6,7,8,9,10,11])
time.sleep(0.05)
if self.lightMode != 'police':
break
time.sleep(0.1)
'''
Red flashes 3 times
'''
for i in range(0,3):
self.setSomeColor(255,0,0,[0,1,2,3,4,5,6,7,8,9,10,11])
time.sleep(0.05)
self.setSomeColor(0,0,0,[0,1,2,3,4,5,6,7,8,9,10,11])
time.sleep(0.05)
time.sleep(0.1)
def breath(self, R_input, G_input, B_input):
'''
Call this function to turn on the breathing light mode, you need to enter three
parameters, namely the brightness of the RGB three color channels, as the color when the
brightness of the breathing lamp is maximum
'''
self.lightMode = 'breath'
self.colorBreathR = R_input
self.colorBreathG = G_input