本文整理汇总了Python中PyGlow.PyGlow.all方法的典型用法代码示例。如果您正苦于以下问题:Python PyGlow.all方法的具体用法?Python PyGlow.all怎么用?Python PyGlow.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyGlow.PyGlow
的用法示例。
在下文中一共展示了PyGlow.all方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import all [as 别名]
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)
示例2: PyGlow
# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import all [as 别名]
# reverse. It lights up 2 arms at once and converges into the #
# third arm. #
# #
# Requirements: PyGlow.py #
# #
# Author: Paul Ryan #
# #
################################################################
from PyGlow import PyGlow
from time import sleep
pyglow = PyGlow()
# Initialize
pyglow.all(0)
# Functions
def confluence_2_and_3_into_1(sleep_speed):
''' Uncomment the following line for feedback while the program is running '''
#print "Confluence 2 and 3 into 1..."
# Arm 2 and 3, Red
pyglow.led(7,120)
pyglow.led(13,120)
sleep(sleep_speed)
# Arm 2 and 3, Orange
pyglow.led(8,120)
pyglow.led(14,120)
sleep(sleep_speed)
# Arm 2 and 3, Yellow
pyglow.led(9,120)
示例3: PyGlow
# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import all [as 别名]
# ! 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)
elif cpu < 60:
pyglow.color("white", 20)
pyglow.color("blue", 20)
pyglow.color("green", 20)
pyglow.color("yellow", 20)
示例4: PyGlow
# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import all [as 别名]
f = urllib2.urlopen('http://api.wunderground.com/api/<your API key>/geolookup/q/autoip.json')
json_string = f.read()
parsed_json = json.loads(json_string)
zip = parsed_json['location']['zip']
f = urllib2.urlopen('http://api.wunderground.com/api/<your API key>/geolookup/conditions/q/%s.json' % (zip))
json_string = f.read()
parsed_json = json.loads(json_string)
location = parsed_json['location']['city']
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)
示例5: PyGlow
# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import all [as 别名]
# * 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)
val = input("All: ")
pyglow.all(val)
示例6: inbox_item_received
# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import all [as 别名]
# 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()
示例7: str
# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import all [as 别名]
# 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"
armright = "m"
armbottom = "h"
###
# End of customising
###
pyglow.all(0)
hourcount = 0
hourcurrent = 0
while True:
time = datetime.now().time()
hour, min, sec = str(time).split(":")
sec, micro = str(sec).split(".")
hour = int(hour)
if show12hr == 1:
if hour > 12:
hour = hour - 12
min = int(min)
示例8: wing
# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import all [as 别名]
#first wing (1 of 3 wings), LEDs 1-6
FAN1 = range(1,7)
#second wing (2 of 3 wings), LEDs 13-18
FAN2 = range(13,19)
#third wing (3 of 3 wings), LEDs 7-12
FAN3 = range(7,13)
#LED INDEXES GROUPED BY COLOR
RED = [1, 7, 13]
ORANGE = [2, 8, 14]
YELLOW = [3, 9, 15]
GREEN = [4, 10, 16]
BLUE = [5, 11, 17]
WHITE = [6, 12, 18]
#reset the colors to zero brightness
piglow = PyGlow()
piglow.all(0)
#functions
def slow_pulse_piglow(color):
piglow = PyGlow(brightness=PULSE_BRIGHTNESS, pulse=True, speed=5000, pulse_dir=BOTH)
piglow.set_leds(color).update_leds()
try:
while True:
#cycle through the colors with a slow pulse
map(slow_pulse_piglow, [RED, ORANGE, YELLOW, GREEN, BLUE, WHITE])
except:
piglow.all(0)