本文整理匯總了Python中PyGlow.PyGlow.color方法的典型用法代碼示例。如果您正苦於以下問題:Python PyGlow.color方法的具體用法?Python PyGlow.color怎麽用?Python PyGlow.color使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyGlow.PyGlow
的用法示例。
在下文中一共展示了PyGlow.color方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
from PyGlow import PyGlow
from time import sleep
import psutil
pyglow = PyGlow()
while True:
cpu = psutil.cpu_percent()
pyglow.all(0)
if cpu < 5:
pyglow.color("white", 20)
elif cpu < 20:
pyglow.color("white", 20)
pyglow.color("blue", 20)
elif cpu < 40:
pyglow.color("white", 20)
pyglow.color("blue", 20)
pyglow.color("green", 20)
elif cpu < 60:
pyglow.color("white", 20)
pyglow.color("blue", 20)
pyglow.color("green", 20)
pyglow.color("yellow", 20)
elif cpu < 80:
pyglow.color("white", 20)
pyglow.color("blue", 20)
示例2: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
from PyGlow import PyGlow
from time import sleep
import os
pyglow = PyGlow()
pyglow.all(0)
for x in range(0, 15):
pyglow.color("orange", brightness=255, speed=500, pulse=True)
sleep(1)
os.system("sudo python /home/pi/pyglow/tempglow.py")
#os.system("sudo python /home/pi/pyglow/weatherpyglow.py") #Set either of these, depending on which type of pyglow lamp you want to reset to
示例3: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
from PyGlow import PyGlow
from time import sleep
pyglow = PyGlow()
pyglow.all(0)
while True:
# blue > purple > red
pyglow.color("blue", 100)
pyglow.color("red", 0)
sleep(0.1)
pyglow.color("red", 10)
pyglow.color("blue", 90)
sleep(0.1)
pyglow.color("red", 20)
pyglow.color("blue", 80)
sleep(0.1)
pyglow.color("red", 30)
pyglow.color("blue", 70)
sleep(0.1)
pyglow.color("red", 40)
pyglow.color("blue", 60)
sleep(0.1)
pyglow.color("red", 50)
pyglow.color("blue", 50)
sleep(0.1)
pyglow.color("red", 60)
pyglow.color("blue", 40)
sleep(0.1)
pyglow.color("red", 70)
示例4: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
temp_f = parsed_json['current_observation']['temp_f']
print "Current temperature in %s is: %s" % (location, temp_f)
f.close()
pyglow = PyGlow() #Setup piglow and turn all off
pyglow.all(0)
pyglow.all(brightness=255, speed=500, pulse=True)
sleep(1)
pyglow.all(brightness=255, speed=500, pulse=True)
sleep(1)
pyglow.all(brightness=255, speed=500, pulse=True)
sleep(1)
temperature=int(temp_f)
if temperature < 0:
pyglow.color("blue", 255)
elif temperature < 10:
pyglow.color("blue", 255)
pyglow.color("green", 200)
elif temperature < 20:
pyglow.color("green", 255)
pyglow.color("blue", 255)
pyglow.color("orange", 150)
pyglow.color("yellow", 255)
elif temperature < 32:
pyglow.color("green", 255)
pyglow.color("blue", 120)
pyglow.color("orange", 150)
pyglow.color("yellow", 255)
elif temperature < 40:
pyglow.color("green", 255)
示例5: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
from bs4 import BeautifulSoup
import urllib2
import re
from PyGlow import PyGlow
pyglow = PyGlow()
pyglow.all(0)
url="http://www.aurora-service.eu/aurora-forecast/"
page=urllib2.urlopen(url)
soup = BeautifulSoup(page.read())
kp = find_string = soup.body.findAll(text=re.compile('Kp'), limit=2)
#rank = soup.find("div", {"class": "rank-box"}).h6.contents
kpstring = str(kp)
kpstring = kpstring[34:]
kpstring = kpstring[:5]
kpvalue = float(kpstring)
print kpvalue
if kpvalue >=2:
#pyglow.all(0)
pyglow.color("green", 200)
elif (kpvalue <2) and (kpvalue > 1):
#pyglow.all(0)
pyglow.color("red", 200)
elif kpvalue <=1:
pyglow.color("yellow", 200)
示例6: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
#
# Python module to control Pimoronis PiGlow
# [http://shop.pimoroni.com/products/piglow]
#
# * test.py - set brightness for each color individually
#
#####
from PyGlow import PyGlow
pyglow = PyGlow()
val = input("White: ")
pyglow.color("white", val)
val = input("Blue: ")
pyglow.color("blue", val)
val = input("Green: ")
pyglow.color("green", val)
val = input("Yellow: ")
pyglow.color("yellow", val)
val = input("Orange: ")
pyglow.color("orange", val)
val = input("Red: ")
pyglow.color("red", val)
示例7: list
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
if armtop == "h":
arm1 = list(binhour)
elif armtop == "m":
arm1 = list(binmin)
else:
arm1 = list(binsec)
led01 = ledbrightness if arm1[5] == "1" else 0
pyglow.led(1, led01)
led02 = ledbrightness if arm1[4] == "1" else 0
pyglow.led(2, led02)
led03 = ledbrightness if arm1[3] == "1" else 0
pyglow.led(3, led03)
led04 = ledbrightness if arm1[2] == "1" else 0
pyglow.led(4, led04)
led05 = ledbrightness if arm1[1] == "1" else 0
pyglow.led(5, led05)
led06 = ledbrightness if arm1[0] == "1" else 0
pyglow.led(6, led06)
# Flash the white leds for the hour
if hourcount != 0:
sleep(0.5)
if hourflash == 1:
pyglow.color("white", ledbrightness)
if hourflash == 2:
pyglow.all(ledbrightness)
sleep(0.5)
hourcount = hourcount - 1
else:
sleep(0.1)
示例8: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
from PyGlow import PyGlow
from time import sleep
pyglow = PyGlow()
pyglow.all(0)
count = 0
while (count < 5):
pyglow.color("white", 60)
sleep(0.1)
pyglow.color("white", 0)
pyglow.color("blue", 100)
sleep(0.1)
pyglow.color("blue", 0)
pyglow.color("green", 100)
sleep(0.1)
pyglow.color("green", 0)
pyglow.color("yellow",100)
sleep(0.1)
pyglow.color("yellow", 0)
pyglow.color("orange",100)
sleep(0.1)
pyglow.color("orange", 0)
pyglow.color("red", 100)
sleep(0.1)
pyglow.color("white", 50)
sleep(0.1)
pyglow.color("white", 0)
pyglow.color("blue", 100)
示例9: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
from PyGlow import PyGlow
from time import sleep
pyglow = PyGlow()
pyglow.all(0)
count = 0
while (count < 10):
pyglow.color("white", 0)
pyglow.color("blue", 110)
sleep(0.1)
pyglow.color("blue", 0)
pyglow.color("green", 100)
sleep(0.1)
pyglow.color("green", 0)
pyglow.color("yellow", 100)
sleep(0.1)
pyglow.color("yellow", 0)
pyglow.color("orange", 100)
sleep(0.2)
pyglow.color("orange", 0)
pyglow.color("red", 100)
sleep(0.3)
示例10: PyGlow
# 需要導入模塊: from PyGlow import PyGlow [as 別名]
# 或者: from PyGlow.PyGlow import color [as 別名]
#PyGlow test
from PyGlow import PyGlow
from time import sleep
pyglow = PyGlow()
pyglow.all(0)
while True:
pyglow.color("blue", 100)
sleep(1)
pyglow.color("blue", 0)
pyglow.color("red", 100)
sleep(1)
pyglow.color("red", 0)
pyglow.update_leds()