本文整理汇总了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)
示例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)
示例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
示例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)
示例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)
示例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)
示例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()
示例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
示例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)
示例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)
示例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)
示例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()
示例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()
示例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"
示例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)}