当前位置: 首页>>代码示例>>Python>>正文


Python PyGlow.led方法代码示例

本文整理汇总了Python中PyGlow.PyGlow.led方法的典型用法代码示例。如果您正苦于以下问题:Python PyGlow.led方法的具体用法?Python PyGlow.led怎么用?Python PyGlow.led使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyGlow.PyGlow的用法示例。


在下文中一共展示了PyGlow.led方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PyGlow

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
#PyGlow test

from PyGlow import PyGlow
from time import sleep

pyglow = PyGlow()

pyglow.all(0)

pyglow.led(1,100)
sleep(1)
pyglow.led(1,0)
sleep(1)

pyglow.update_leds()
开发者ID:rixwoodling,项目名称:programming,代码行数:17,代码来源:FirstPiGlow.py

示例2: PyGlow

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
#! /usr/bin/local/python3

from PyGlow import PyGlow
from time import sleep
import random

pyglow = PyGlow()

pyglow.all(0)

while True:
        randomLED = random.randint(1,18)
        randomBright = random.randint(0,100)
        pyglow.led(randomLED,randomBright)
        sleep(0.1)
        pyglow.led(randomLED,0)

pyglow.all(0)
开发者ID:sharland,项目名称:python_scripts,代码行数:20,代码来源:randomlights.py

示例3: PyGlow

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
##################################################
## 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,代码行数:27,代码来源:betelnut11.py

示例4: range

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
        else:
            while counter >= threshold:
                counter -= threshold
                BallX += BallXSpeed
                BallY += BallYSpeed
                if BallX == 0 or BallX == WIDTH - 1:
                    p.ChangeFrequency(N_SCORE)
                    p.start(50)                    
                    Serving = True
                    ServeCount = (ServeCount + 1) % 10
                    if BallX == 0: Player1Score += 1
                    else: Player0Score += 1

                    BallXSpeed = 1 if ServeCount < 5 else -1
                    for i in range(1, 19):
                        glow.led(i, 255)
                        sleep(.05)
                    p.ChangeFrequency(N_SCORE+200)
                    for i in range(18, 0, -1):
                        glow.led(i, 0)
                        sleep(.05)
                if BallX == 2 and 0 <= BallY - Player0Bat < Player0Height or BallX == WIDTH - 3 and 0 <= BallY - Player1Bat < Player1Height:
                    N_BOUNCE = abs(N_BOUNCE - 1500)
                    p.ChangeFrequency(N_BOUNCE)
                    p.start(50)
                    sfxStartTime = time()
                    BallXSpeed = -BallXSpeed
                    BallX += BallXSpeed
                    if BallX == 3:
                        BallYSpeed = 3 * (BallY - Player0Bat) / Player0Height - 1
                    else:
开发者ID:gfsduog,项目名称:prom,代码行数:33,代码来源:main.py

示例5: int

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
    binmin = "%06d" % int(bin(min)[2:])
    binsec = "%06d" % int(bin(sec)[2:])

    # Check if current hour is different and set ready to flash hour
    if hourcurrent != hour:
        hourcount = hour
        hourcurrent = hour

    if armbottom == "h":
        arm3 = list(binhour)
    elif armbottom == "m":
        arm3 = list(binmin)
    else:
        arm3 = list(binsec)
    led13 = ledbrightness if arm3[5] == "1" else 0
    pyglow.led(13, led13)
    led14 = ledbrightness if arm3[4] == "1" else 0
    pyglow.led(14, led14)
    led15 = ledbrightness if arm3[3] == "1" else 0
    pyglow.led(15, led15)
    led16 = ledbrightness if arm3[2] == "1" else 0
    pyglow.led(16, led16)
    led17 = ledbrightness if arm3[1] == "1" else 0
    pyglow.led(17, led17)
    led18 = ledbrightness if arm3[0] == "1" else 0
    pyglow.led(18, led18)

    if armright == "h":
        arm2 = list(binhour)
    elif armright == "m":
        arm2 = list(binmin)
开发者ID:Vrolki,项目名称:PyGlow,代码行数:33,代码来源:clock.py

示例6: PyGlow

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
##################################################

from PyGlow import PyGlow
from time import sleep

pyglow = PyGlow()
val = 100
color = 2
dark = 1

pyglow.all(0)

while True:
	if color == 7:
		break
	pyglow.led(color, val)
	pyglow.led(dark, 0)
	sleep(0.5)

	color = color + 1
	dark = dark + 1

while True:	
	a = color
	b = a + 6
	
	pyglow.led(a, val)
	pyglow.led(b, val)
	sleep(0.1)	

	high = high + 1
开发者ID:rixwoodling,项目名称:programming,代码行数:33,代码来源:betelnut12.py

示例7: PyGlow

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
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,代码行数:33,代码来源:betelnut13.py

示例8: input

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
#####
#
# 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,代码行数:32,代码来源:pulsetest.py

示例9: PyGlow

# 需要导入模块: from PyGlow import PyGlow [as 别名]
# 或者: from PyGlow.PyGlow import led [as 别名]
from PyGlow import PyGlow
from time import sleep

pyglow = PyGlow()

pyglow.all(0)

count = 0
while (count < 10):
	pyglow.led(1, 100)
	pyglow.led(7, 100)
	pyglow.led(13,100)
	sleep(0.1)
	pyglow.led(1, 0)
	pyglow.led(7, 0)
	pyglow.led(13,0)

	pyglow.led(2, 100)
	pyglow.led(8, 100)
	pyglow.led(14,100)
	sleep(0.1)
	pyglow.led(2, 0)
	pyglow.led(8, 0)
	pyglow.led(14,0)

	pyglow.led(3, 100)
	pyglow.led(9, 100)
	pyglow.led(15,100)
	sleep(0.1)
	pyglow.led(3, 0)
	pyglow.led(9, 0)
开发者ID:rixwoodling,项目名称:programming,代码行数:33,代码来源:betelnut02.py


注:本文中的PyGlow.PyGlow.led方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。