當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。