本文整理汇总了Python中piglow.PiGlow.red方法的典型用法代码示例。如果您正苦于以下问题:Python PiGlow.red方法的具体用法?Python PiGlow.red怎么用?Python PiGlow.red使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类piglow.PiGlow
的用法示例。
在下文中一共展示了PiGlow.red方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: file
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
else: #no pid file exists, lets go ahead and run
file(pidfile, 'w').write(pid)
while 1:
cpu = psutil.cpu_percent(interval=0.5)
piglow.all(0)
if cpu <= 10:
piglow.green(1)
elif cpu >= 11 and cpu <= 20:
piglow.green(2)
elif cpu >= 21 and cpu <= 30:
piglow.green(3)
elif cpu >= 31 and cpu <= 40:
piglow.green(4)
elif cpu >= 41 and cpu <= 50:
piglow.yellow(5)
elif cpu >= 51 and cpu <= 60:
piglow.yellow(6)
elif cpu >= 61 and cpu <= 70:
piglow.yellow(7)
elif cpu >= 71 and cpu <= 80:
piglow.yellow(8)
elif cpu >= 81 and cpu <= 90:
piglow.red(9)
elif cpu >= 91:
piglow.red(10)
else:
piglow.green(1)
示例2: PiGlow
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
###############################################################
# Set the LEDs to turn on/off in pairs of 2 toward the centre,
# whilst increasing and decreasing in brightness
# shifty051
###############################################################
from piglow import PiGlow
from time import sleep
piglow = PiGlow()
while True:
piglow.red(1)
sleep(0.1)
piglow.red(2)
sleep(0.1)
piglow.red(3)
piglow.orange(1)
sleep(0.1)
piglow.red(4)
piglow.orange(2)
sleep(0.1)
piglow.red(3)
piglow.orange(3)
sleep(0.1)
示例3: sleep
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
sleep(0.1)
#Fade all orange LEDs on
piglow.orange(51)
sleep(0.1)
piglow.orange(102)
sleep(0.1)
piglow.orange(153)
sleep(0.1)
piglow.orange(204)
sleep(0.1)
piglow.orange(255)
sleep(0.1)
#Fade all red LEDs on
piglow.red(51)
sleep(0.1)
piglow.red(102)
sleep(0.1)
piglow.red(153)
sleep(0.1)
piglow.red(204)
sleep(0.1)
piglow.red(255)
sleep(0.5)
#Fade all white LEDs off
piglow.white(204)
sleep(0.1)
piglow.white(153)
sleep(0.1)
示例4: PiGlow
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
#!/usr/bin/python
from piglow import PiGlow
# yellow
piglow = PiGlow()
piglow.white(0)
piglow.blue(0)
piglow.green(0)
piglow.yellow(100)
piglow.orange(0)
piglow.red(0)
示例5: PiGlow
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
from piglow import PiGlow
from time import sleep
piglow = PiGlow()
print("You will now be asked how bright you would like each LED to be, choose a number between 0 and 255")
sleep(3)
val1 = input("White: ")
val2 = input("Blue: ")
val3 = input("Green: ")
val4 = input("Yellow: ")
val5 = input("Orange: ")
val6 = input("Red: ")
delay = input("How long is the delay between flashes? :")
while True:
piglow.white(val1)
sleep(delay)
piglow.blue(val2)
sleep(delay)
piglow.green(val3)
sleep(delay)
piglow.yellow(val4)
sleep(delay)
piglow.orange(val5)
sleep(delay)
piglow.red(val6)
sleep(delay)
piglow.all(0)
示例6: PiGlow
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
#!/usr/bin/env python
from piglow import PiGlow
piglow = PiGlow()
piglow.red(255)
示例7: calculate_intensity
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
#print ("Blue")
intensity['blue'] = calculate_intensity(norm_midnight_diff,centre,0.15,255)
intensity['blue'] += calculate_intensity(norm_noon_diff,centre,0.09,255)
#print ("White")
intensity['white'] = calculate_intensity(norm_noon_diff,centre,0.07,64)
total_intensity = 0
for key in intensity:
if (intensity[key] > 255):
intensity[key] = 255
else:
intensity[key] = int(round(intensity[key]))
total_intensity += intensity[key]
# print ("Key = %s, value = %i\n" % (key, intensity[key]))
piglow.red(intensity['red'])
piglow.orange(intensity['orange'])
piglow.yellow(intensity['yellow'])
piglow.green(intensity['green'])
piglow.blue(intensity['blue'])
piglow.white(intensity['white'])
# Condensed logging for graphing purposes (time, followed by the colours)
logging.info("%i %i %i %i %i %i %i %i" %(epoch_now,
intensity['red'],
intensity['orange'],
intensity['yellow'],
intensity['green'],
intensity['blue'],
intensity['white'],
示例8: PiGlow
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
# Shifty051
########################################################################
from piglow import PiGlow
from time import sleep
import psutil
piglow = PiGlow()
while True:
cpu = psutil.cpu_percent()
piglow.all(0)
if cpu < 5:
piglow.red(10)
elif cpu < 20:
piglow.red(1)
piglow.orange(1)
elif 20 < cpu < 49:
piglow.red(1)
piglow.orange(1)
piglow.yellow(1)
elif cpu < 60:
piglow.red(1)
piglow.orange(1)
piglow.yellow(1)
piglow.green(1)
示例9: PiGlow
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
#!/usr/bin/python
from piglow import PiGlow
# red
piglow = PiGlow()
piglow.white(0)
piglow.blue(0)
piglow.green(0)
piglow.yellow(0)
piglow.orange(0)
piglow.red(200)
示例10: PiGlow
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
######################################################
## Set each colour to a brightness of your choosing ##
## ##
## Example by Jason - @Boeeerb ##
######################################################
from piglow import PiGlow
piglow = PiGlow()
val = input("White: ")
piglow.white(val)
val = input("Blue: ")
piglow.blue(val)
val = input("Green: ")
piglow.green(val)
val = input("Yellow: ")
piglow.yellow(val)
val = input("Orange: ")
piglow.orange(val)
val = input("Red: ")
piglow.red(val)
val = input("All: ")
piglow.all(val)
示例11: PiGlow
# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import red [as 别名]
#!/usr/bin/python
from time import sleep
from piglow import PiGlow
piglow = PiGlow()
piglow.all(0)
# the police
for i in range(1, 20):
piglow.all(0)
piglow.blue(100)
sleep(.2)
piglow.all(0)
piglow.red(100)
sleep(.2)
piglow.all(0)
piglow.all(200)
piglow.all(0)