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


Python PyGlow.all方法代碼示例

本文整理匯總了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)
開發者ID:benleb,項目名稱:PyGlow,代碼行數:13,代碼來源:bin_clock.py

示例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)
開發者ID:ShineTop,項目名稱:PiGlow,代碼行數:33,代碼來源:Confluence.py

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

示例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)
開發者ID:Vrolki,項目名稱:wu_pyglow_weather_lamp,代碼行數:32,代碼來源:tempglow.py

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

示例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()
開發者ID:sebshub,項目名稱:twitterpibot,代碼行數:31,代碼來源:MyPiglow.py

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

示例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)
開發者ID:samrocketman,項目名稱:home,代碼行數:32,代碼來源:piglow.py


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