本文整理匯總了Python中piglow.PiGlow.led方法的典型用法代碼示例。如果您正苦於以下問題:Python PiGlow.led方法的具體用法?Python PiGlow.led怎麽用?Python PiGlow.led使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類piglow.PiGlow
的用法示例。
在下文中一共展示了PiGlow.led方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: int
# 需要導入模塊: from piglow import PiGlow [as 別名]
# 或者: from piglow.PiGlow import led [as 別名]
i = i+1
while True:
response = urllib2.urlopen('http://ryanteck.org.uk/nginx_status')
html = response.read()
data = html.split('\n')
active = data[0].split(":")
count = active[1]
count = int(count) -1;
#print(count)
if(count ==0):
piglow.all(0)
#top leg
if(count >=1):
piglow.led(6,127)
if(count >=2):
piglow.led(5,127)
if(count >=3):
piglow.led(4,127)
if(count >=4):
piglow.led(3,127)
if(count >=5):
piglow.led(2,127)
if(count >=6):
piglow.led(1,127)
#bottom leg
if(count >=7):
piglow.led(12,127)
if(count >=8):
piglow.led(11,127)
示例2: sleep
# 需要導入模塊: from piglow import PiGlow [as 別名]
# 或者: from piglow.PiGlow import led [as 別名]
piglow.blue(1)
piglow.white(3)
sleep(0.1)
piglow.blue(0)
piglow.white(2)
sleep(0.1)
piglow.white(1)
sleep(0.1)
piglow.white(0)
sleep(0.1)
piglow.led(1,1)
sleep(0.1)
piglow.led(1,2)
sleep(0.1)
piglow.led(1,3)
piglow.led(7,1)
sleep(0.1)
piglow.led(1,4)
piglow.led(7,2)
sleep(0.1)
piglow.led(7,3)
piglow.led(13,1)
示例3: range
# 需要導入模塊: from piglow import PiGlow [as 別名]
# 或者: from piglow.PiGlow import led [as 別名]
piglow.all(0) # turn off all led,
while y > 0: # Begin the pulse loop
for x in range(255): # Start the brighten loop
m = (x % 19) # Make sure to only have 1-18 for led
# by dividing by 19 and using the remainder
if m == 0: # LED can't be zero so if it is, set to 1
m= m + 1
n = (x % 255) # Make sure the brightness value does not exceed 255
# by dividing by 255 and using the remainder
piglow.led(m,n) # Set the led m=led, n=brightness
time.sleep(q) # Delay the loop by q
x = x + 1 # Add one to x and loop
while x > 0: # Start the dimming loop
m = (x % 19)
if m == 0: # LED can't be zero so if it is set to 1
m= m + 1
n = (x % 255) # Make sure the brightness value does not exceed 255
示例4: int
# 需要導入模塊: from piglow import PiGlow [as 別名]
# 或者: from piglow.PiGlow import led [as 別名]
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
piglow.led(13,led13)
led14 = ledbrightness if arm3[4] == "1" else 0
piglow.led(14,led14)
led15 = ledbrightness if arm3[3] == "1" else 0
piglow.led(15,led15)
led16 = ledbrightness if arm3[2] == "1" else 0
piglow.led(16,led16)
led17 = ledbrightness if arm3[1] == "1" else 0
piglow.led(17,led17)
led18 = ledbrightness if arm3[0] == "1" else 0
piglow.led(18,led18)
if armright == "h":
arm2 = list(binhour)
elif armright == "m":
arm2 = list(binmin)
示例5: PiGlow
# 需要導入模塊: from piglow import PiGlow [as 別名]
# 或者: from piglow.PiGlow import led [as 別名]
#######################################################
## Quickly increase and decrease each LED one by one ##
## ##
## Example by Jason - @Boeeerb ##
#######################################################
from piglow import PiGlow
from time import sleep
piglow = PiGlow()
val = 0
count = 1
while True:
leds = range(1, 19, +1)
for led in leds:
if count == 1:
val = val + 1
if val > 90:
count = 0
else:
val = val - 1
if val < 1:
count = 1
piglow.led(led, val)
sleep(0.0075)
示例6: PiGlow
# 需要導入模塊: from piglow import PiGlow [as 別名]
# 或者: from piglow.PiGlow import led [as 別名]
###############################################################
# Set the LEDs to turn on/off sequentially in a spiral fashion toward the centre
# This is a modified version of 'spiralS.py', where the LEDs remain on throughout the cycle.
# shifty051
###############################################################
from piglow import PiGlow
from time import sleep
piglow = PiGlow()
while True:
piglow.led(1,1)
sleep(0.1)
piglow.led(7,1)
sleep(0.1)
piglow.led(13,1)
sleep(0.1)
piglow.led(2,1)
sleep(0.1)
piglow.led(8,1)
sleep(0.1)
piglow.led(14,1)
sleep(0.1)
示例7: PiGlow
# 需要導入模塊: from piglow import PiGlow [as 別名]
# 或者: from piglow.PiGlow import led [as 別名]
##################################################
## Switch each colour on in sequence on and off ##
## ##
## Example by Jason - @Boeeerb ##
##################################################
from piglow import PiGlow
from time import sleep
piglow = PiGlow()
val = 20
colour = 1
while True:
if colour == 19:
colour = 1
if val == 20:
val = 0
else:
val = 20
piglow.led(colour, val)
sleep(0.2)
colour = colour + 1
示例8: range
# 需要導入模塊: from piglow import PiGlow [as 別名]
# 或者: from piglow.PiGlow import led [as 別名]
# Odd then even leds
#l=[1,3,5,7,9,11,13,14,17,2,4,6,8,10,12,14,16,18]
# An alternate writing pattern that starts at center and moves
# out, around the center counter clockwise.
# Uncomment only one at a time
l=[12,6,18,11,5,17,10,4,16,9,3,15,8,2,14,7,1,13
piglow.all(0) # Turn off all led, just a housekeeping line
while y > 0: # Begin the pulse loop
while x < maxbrite : # Start the brighten loop. The max is 255 for brightness of led
for m in range(18): # Loop to set the leds to current brightness
piglow.led(l[m],x) # Set the led l[m]=led, n=brightness
m = m + 1 # Move to next in list l
time.sleep(q) # Delay the loop by q
x = x + 1 # Add one to x and loop
while x > 0 : # Start the dimming loop
for m in range(18): # Loop to set the leds to current brightness
piglow.led(l[m],x) # Set the led l[m]=led, n=brightness
m = m + 1 # Move to next in list l
time.sleep(q) # Delay the loop by q