当前位置: 首页>>代码示例>>Python>>正文


Python PyGlow.color方法代码示例

本文整理汇总了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)
开发者ID:Vrolki,项目名称:PyGlow,代码行数:32,代码来源:cpu.py

示例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

开发者ID:Vrolki,项目名称:wu_pyglow_weather_lamp,代码行数:15,代码来源:lowbatt.py

示例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)
开发者ID:rixwoodling,项目名称:programming,代码行数:33,代码来源:betelnut05.py

示例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)
开发者ID:Vrolki,项目名称:wu_pyglow_weather_lamp,代码行数:33,代码来源:tempglow.py

示例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)


开发者ID:Jameshooper,项目名称:Nlights,代码行数:29,代码来源:ab.py

示例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)
开发者ID:Vrolki,项目名称:PyGlow,代码行数:33,代码来源:test.py

示例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)
开发者ID:Vrolki,项目名称:PyGlow,代码行数:32,代码来源:clock.py

示例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)
开发者ID:rixwoodling,项目名称:programming,代码行数:33,代码来源:betelnut06.py

示例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)

开发者ID:rixwoodling,项目名称:programming,代码行数:31,代码来源:betelnut09.py

示例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()
开发者ID:rixwoodling,项目名称:programming,代码行数:20,代码来源:FlashPiGlow.py


注:本文中的PyGlow.PyGlow.color方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。