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