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


Python PiGlow.colour方法代码示例

本文整理汇总了Python中piglow.PiGlow.colour方法的典型用法代码示例。如果您正苦于以下问题:Python PiGlow.colour方法的具体用法?Python PiGlow.colour怎么用?Python PiGlow.colour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在piglow.PiGlow的用法示例。


在下文中一共展示了PiGlow.colour方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: light_piglow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import colour [as 别名]
def light_piglow(colour,rotations):
    colourmap = {14 : "red", 13 : "green", 11 : "blue", 1: "orange", 4 : "yellow", 15 : "white" }
    from piglow import PiGlow
    piglow = PiGlow()
#    piglow.all(0)
    if ( colour != "all" ):
        ledcolour = colourmap[colour]
        for j in range(rotations):
            piglow.colour(ledcolour,j)
            sleep(0.001*j) # As the intensity increases, sleep for longer periods
    else:
    #    print ("Trying to run all ")
        for j in range(rotations):
            for colour in (colourmap.values()):
                piglow.colour(("%s" % colour), 255)
                sleep(0.2)
                piglow.colour(colour, 0)
                sleep(0.01)
    piglow.all(0)
开发者ID:tommybobbins,项目名称:minecraft_flashcards,代码行数:21,代码来源:lighthouse_setup.py

示例2: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import colour [as 别名]
from piglow import PiGlow
from time import sleep
import psutil

piglow = PiGlow()

# start at white
colour = 1

while True:
    # returns a value from 0 - 1 representing current CPU load
    cpu = psutil.cpu_percent()

    # now we need to scale that CPU level to the range 0 - 255 for PiGlow brightness
    brightness = max( (int)(cpu * 255), 1)

    # pick a speed that gets faster as the CPU usage increases
    speed = max ( 1.2 - cpu, 0.1 )

    # turn everything off, let's get ready to rumble
    piglow.all(0)

    # turn on the next "ring" of colour
    piglow.colour(colour, brightness)

    # sleep for a bit, i'm weary...
    sleep(speed)

    # increment to the next colour (reset to white if we're already on red)
    colour = colour + 1 if colour < 6 else 1
开发者ID:CornishSteve,项目名称:PiGlow-CPU-Monitor,代码行数:32,代码来源:PiGlow_CPU_Monitor.py

示例3: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import colour [as 别名]
#!/usr/bin/env python
from piglow import PiGlow
import time
import random
i = 0
j = 1
k = 2
piglow = PiGlow()
piglow.all(0)
goingUp = 1


while True:
	time.sleep(.03)
	if goingUp == 1:
		piglow.colour(j, i)
		i+=5
	else:
		piglow.colour(j, i)
		i-=5

	if i == 255:
		goingUp = 0
	if i == 0:
		piglow.colour(j, i)
		goingUp = 1
		
		j = random.randint(1,6)
开发者ID:x41x41x90,项目名称:x41-piglow,代码行数:30,代码来源:mine.py

示例4: len

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import colour [as 别名]
			ltcbuypad = len(str(ltcjson["ticker"]["buy"]))
			ltcsellpad = len(str(ltcjson["ticker"]["sell"]))

			stdscr.addstr(8,16+buypad,"     ")
			stdscr.addstr(8,35+sellpad,"     ")
			stdscr.addstr(10,16+ltcbuypad,"    ")
			stdscr.addstr(10,35+ltcsellpad,"    ")
			
			stdscr.addstr(8,16,str(btcejson["ticker"]["buy"]))
			stdscr.addstr(8,35,str(btcejson["ticker"]["sell"]))
			stdscr.addstr(10,16,str(ltcjson["ticker"]["buy"]))
			stdscr.addstr(10,35,str(ltcjson["ticker"]["sell"]))
			stdscr.refresh()
			
			if float(list["DEVS"][0]["MHS 5s"]) / 1000 >= 7.7 and float(list["DEVS"][0]["MHS 5s"]) / 1000 < 7.8:
				piglow.colour(color[0],10)
				piglow.colour(color[1],0)
				piglow.colour(color[2],0)
				piglow.colour(color[3],0)
				piglow.colour(color[4],0)
				piglow.colour(color[5],0)
			elif float(list["DEVS"][0]["MHS 5s"]) / 1000 >= 7.8 and float(list["DEVS"][0]["MHS 5s"]) / 1000 < 7.9:
				piglow.colour(color[0],10)
				piglow.colour(color[1],10)
				piglow.colour(color[2],0)
				piglow.colour(color[3],0)
				piglow.colour(color[4],0)
				piglow.colour(color[5],0)
			elif float(list["DEVS"][0]["MHS 5s"]) / 1000 >= 7.9 and float(list["DEVS"][0]["MHS 5s"]) / 1000 < 8.0:
				piglow.colour(color[0],10)
				piglow.colour(color[1],10)
开发者ID:haincha,项目名称:BTC-E-Ticker,代码行数:33,代码来源:btceticker.py


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