當前位置: 首頁>>代碼示例>>Python>>正文


Python PyGlow.PyGlow類代碼示例

本文整理匯總了Python中PyGlow.PyGlow的典型用法代碼示例。如果您正苦於以下問題:Python PyGlow類的具體用法?Python PyGlow怎麽用?Python PyGlow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PyGlow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: spaz

def spaz():
    piglow = PyGlow()
    for x in range(1,19)+range(18,0,-1):
        piglow.set_leds([x], 255).update_leds()
        sleep(0.01)
        piglow.set_leds([x], 0).update_leds()
        sleep(0.05)
開發者ID:samrocketman,項目名稱:home,代碼行數:7,代碼來源:piglow-daemon.py

示例2: main

def main():
    print(' %5s | %6s | %6s' % ('Hour', 'Minute', 'Second'))

    pg = PyGlow(brightness=150, pulse=True, speed=1000, pulse_dir=BOTH)

    try:
        while True:
            print_time(pg)
    except KeyboardInterrupt:
        print('')
        pg.all(0)
開發者ID:benleb,項目名稱:PyGlow,代碼行數:11,代碼來源:bin_clock.py

示例3: PyGlow

from PyGlow import PyGlow
from time import sleep
import os
pyglow = PyGlow()
pyglow.all(0)


for x in range(0, 15):
   pyglow.color("green", 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,代碼行數:13,代碼來源:call.py

示例4: Jason

# Python module to control Pimoronis PiGlow
# [http://shop.pimoroni.com/products/piglow]
#
# * cpu.py - cpu percentage utilisation indicator by Jason (@Boeeerb)
# [https://github.com/Boeeerb/PiGlow]
# ! requires psutil - sudo apt-get install python-psutil
#
#####


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)
開發者ID:Vrolki,項目名稱:PyGlow,代碼行數:31,代碼來源:cpu.py

示例5: PyGlow

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,代碼行數:31,代碼來源:betelnut05.py

示例6: PyGlow

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,代碼行數:27,代碼來源:ab.py

示例7: inbox_item_received

    time.sleep(0.25)

    # noinspection PyUnusedLocal
    def inbox_item_received(self, inbox_item):

        for led in range(18):
            if _buffer[led] > 1:
                if random.randint(0, 1) == 0:
                    _buffer[led] = 255
                else:
                    _buffer[led] = 0
        _write_all()


_maxbright = 255
_piglow = PyGlow()
_piglow.all(0)

_buffer = {}
for l in range(18):
    _buffer[l] = 0

_modes = itertools.cycle([
    DotsMode(),
    FlashMode()
])
_mode = next(_modes)


def lights():
    _mode.lights()
開發者ID:sebshub,項目名稱:twitterpibot,代碼行數:31,代碼來源:MyPiglow.py

示例8: PyGlow

##################################################
## Switch each colour on in sequence on and off ##
##                                              ##
## Example by Jason - @Boeeerb                  ##
##################################################

from PyGlow import PyGlow
from time import sleep

pyglow = PyGlow()
val = 20
colour = 1

while True:
    if colour == 19:
        colour = 1
        if val == 20:
            val = 0
        else:
            val = 20
    
    pyglow.led(colour, val)
    sleep(0.05)

    colour = colour + 1
開發者ID:rixwoodling,項目名稱:programming,代碼行數:25,代碼來源:betelnut11.py

示例9: PyGlow

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,代碼行數:31,代碼來源:betelnut06.py

示例10: PyGlow

from PyGlow import PyGlow
from time import sleep

pyglow = PyGlow()
count = 0
while (count < 8):
	pyglow.color("white", 100)
	sleep(0.05)
	pyglow.color("blue", 110)
	sleep(0.05)
        pyglow.color("green", 100)
        sleep(0.05)
        pyglow.color("yellow", 100)
        pyglow.color("white", 80)
        sleep(0.05)
        pyglow.color("orange", 100)
        pyglow.color("white", 60)
        sleep(0.05)
        pyglow.color("red", 100)
        pyglow.color("white", 40)
        sleep(0.05)

        pyglow.color("white",   0)
        sleep(0.05)
        pyglow.color("blue",   0)
        sleep(0.05)
        pyglow.color("green",   0)
        sleep(0.05)
        pyglow.color("yellow",   0)
        sleep(0.05)
        pyglow.color("orange",   0)
開發者ID:rixwoodling,項目名稱:programming,代碼行數:31,代碼來源:betelnut08.py

示例11: PyGlow

from PyGlow import PyGlow
from time import sleep

pyglow = PyGlow()

pyglow.all(0)

count = 0

while (count < 20):
	pyglow.led(1, 100)
	pyglow.led(8, 100)
	pyglow.led(15,100)
	pyglow.led(4, 100)
	pyglow.led(11,110)
	pyglow.led(18,40)
	sleep(0.1)
	pyglow.led(1, 0)
	pyglow.led(8, 0)
	pyglow.led(15,0)
	pyglow.led(4, 0)
	pyglow.led(11,0)
	pyglow.led(18,0)
        pyglow.led(13,100)
        pyglow.led(2, 100)
        pyglow.led(9, 100)
	pyglow.led(16,100)
	pyglow.led(5, 110)
	pyglow.led(12,40)
        sleep(0.1)
        pyglow.led(13,0)
開發者ID:rixwoodling,項目名稱:programming,代碼行數:31,代碼來源:betelnut13.py

示例12: input

#####
#
# Python module to control Pimoronis PiGlow
# [http://shop.pimoroni.com/products/piglow]
#
# * pulsetest.py - test the pulsing light feature
#
#####


from PyGlow import PyGlow


b = input("Maximum brightness: ")
s = input("Speed in milliseconds (try 1000 as a default): ")

pyglow = PyGlow(brightness=b, speed=s, pulse=True)

pyglow.all(0)

print("Pulsing 1 Light")
pyglow.led(1)

print("Pulsing Arms")
pyglow.arm(1)
pyglow.arm(2)
pyglow.arm(3)

print("Pulsing All")
pyglow.all()
開發者ID:Vrolki,項目名稱:PyGlow,代碼行數:30,代碼來源:pulsetest.py

示例13: PyGlow

#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,代碼行數:18,代碼來源:FlashPiGlow.py

示例14: Jason

#
# Python module to control Pimoronis PiGlow
# [http://shop.pimoroni.com/products/piglow]
#
# * clock.py - binary clock by Jason (@Boeeerb)
# [https://github.com/Boeeerb/PiGlow]
#
#####


from PyGlow import PyGlow
from time import sleep
from datetime import datetime


pyglow = PyGlow()

##
# You can customise these settings:
##

# Show 12 or 24hr clock - 0= 24hr, 1= 12hr
show12hr = 0
# Set brightness of LED - 1-255
# (recommend 10-20, put 0 and you won't see it!)
ledbrightness = 50
# Choose how to flash change of hour - 1= white leds, 2= all flash
hourflash = 1

# h= hour, m= minutes, s= seconds
armtop = "s"
開發者ID:Vrolki,項目名稱:PyGlow,代碼行數:31,代碼來源:clock.py

示例15: Jason

#
# Python module to control Pimoronis PiGlow
# [http://shop.pimoroni.com/products/piglow]
#
# * clock.py - binary clock by Jason (@Boeeerb) & Remi (rparpa)
# [https://github.com/Boeeerb/PiGlow]
#
#####


from PyGlow import PyGlow
from time import sleep
from datetime import datetime


pyglow = PyGlow()

##
# You can customise these settings:
##

# Show 12 or 24hr clock - 0= 24hr, 1= 12hr
show12hr = 0
# Set brightness of LED - 1-255
# (recommend 10-20, put 0 and you won't see it!)
led_brightness = 50
# Choose how to flash change of hour - 1= white leds, 2= all flash
hour_flash = 2

# arms
arm_top = {i: 0 for i in range(1, 7)}
開發者ID:benleb,項目名稱:PyGlow,代碼行數:31,代碼來源:clock.py


注:本文中的PyGlow.PyGlow類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。