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


Python PiGlow.all方法代码示例

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


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

示例1: light_piglow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
def light_piglow(colour,rotations):
    colourmap = {14 : "red", 13 : "green", 11 : "blue", 1: "orange", 4 : "yellow", 15 : "white" }
    from piglow import PiGlow
    piglow = PiGlow()
#    piglow.all(0)
    if ( colour != "all" ):
        ledcolour = colourmap[colour]
        for j in range(rotations):
            piglow.colour(ledcolour,j)
            sleep(0.001*j) # As the intensity increases, sleep for longer periods
    else:
    #    print ("Trying to run all ")
        for j in range(rotations):
            for colour in (colourmap.values()):
                piglow.colour(("%s" % colour), 255)
                sleep(0.2)
                piglow.colour(colour, 0)
                sleep(0.01)
    piglow.all(0)
开发者ID:tommybobbins,项目名称:minecraft_flashcards,代码行数:21,代码来源:lighthouse_setup.py

示例2: int

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
	time.sleep(0.1)
	piglow.arm3(0)
	#Test Completed
	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):
开发者ID:ryanteck,项目名称:webGlow,代码行数:33,代码来源:webglow.py

示例3: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
######################################################

# Import needed modules
import time
from piglow import PiGlow

# An alias, so you can type piglow rather than PiGlow()
piglow = PiGlow()

q = 0.0003   # Delay for time.sleep in seconds
x = 1        # Iniialize x, 0 causes .led to turn them off
             # Used to define led and brightness
       
y = 1        # Initialize y for main loop

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 
开发者ID:jcoffey42,项目名称:Python,代码行数:33,代码来源:pulse_01.py

示例4: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
###############################################################
# Set the LEDs to turn on/off in pairs of 2 toward the centre, 
# whilst increasing and decreasing in brightness
# shifty051
###############################################################

from piglow import PiGlow
from time import sleep
piglow = PiGlow()

piglow.all(0)

while True:
  
  i=0

  piglow.red(1)
  sleep(0.1)
  
  piglow.red(2)
  sleep(0.1)
  
  piglow.red(3)
  piglow.orange(1)
  sleep(0.1)
  
  piglow.red(4)
  piglow.orange(2)
  sleep(0.1)
  
  piglow.red(3)
开发者ID:shifty051,项目名称:PiGlow,代码行数:33,代码来源:brightS.py

示例5: main

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
def main():
    piglow = PiGlow()
    piglow.all(0)
开发者ID:noelevans,项目名称:sandpit,代码行数:5,代码来源:reset_piglow.py

示例6: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
#!/usr/bin/env python
from piglow import PiGlow
piglow = PiGlow()
piglow.all(255)
开发者ID:x41x41x90,项目名称:x41-piglow,代码行数:6,代码来源:all.py

示例7: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
## Author: Daniel Pullan
## Github: GitHub.com/DanielPullan
## Website: DanielPullan.co.uk

from time import sleep
from config import email, password, mail
from piglow import PiGlow

## Init the current device
piglow = PiGlow()

## Device parameters
piglow.all(0)

if mail == 0:
        print "no mail"
        piglow.all(0)
        sleep(0.5)
elif mail < 5:
        print "mail count low"
        piglow.arm1(10)
        sleep(0.5)
elif mail < 10:
        print "mail count medium"
        piglow.arm1(10)
        piglow.arm2(10)
        sleep(0.5)
elif mail < 15:
        print "mail count high"
        piglow.arm1(10)
        piglow.arm2(10)
开发者ID:DanielPullan,项目名称:gmail-notify,代码行数:33,代码来源:gmn-piglow.py

示例8: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
piglow = PiGlow()


### You can customise these settings ###

show12hr = 1            # Show 12 or 24hr clock - 0= 24hr, 1= 12hr
ledbrightness = 10      # Set brightness of LED - 1-255 (recommend 10-20, put 0 and you won't see it!)
hourflash = 1           # Choose how to flash change of hour - 1= white leds, 2= all flash

armtop = "s"            # h= hour, m= minutes, s= seconds
armright = "m"
armbottom = "h"

### End of customising ###

piglow.all(0)

hourcount = 0
hourcurrent = 0

while True:
    time = datetime.now().time()
    hour,min,sec = str(time).split(":")

    # Bug fix by Phil Moyer - Currently under test
    try:
        rv = str(sec).index(".")
        sec,micro = str(sec).split(".")
    except ValueError:
        sec = str(sec)
        micro = "0"
开发者ID:kvvs,项目名称:PiGlow,代码行数:33,代码来源:TESTING-clock.py

示例9: __init__

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
class PiGlow_Status_Server:

  def __init__ (self):

    self.cfg = PiGlow_Status_Config ()
    self.commands = PiGlow_Status_Commands ()
    self.idle_job = self.commands.CLOCK
    self.jobs = []
    self.running = None
    self.locked_thread = None
    self.check_jobs_thread = None
    self.socket_manager_thread = None
    self.piglow = None
    self.clock = None
    self.alert = None
    self.in_progress = None
    self.job_interval = 0.1
    self.quiet_time = False


  def start (self):
    """Creates the socket and starts the threads"""

    try:
      self.piglow = PiGlow ()

    except IOError as e:

      if e[0] == errno.EACCES:
        print >> sys.stderr, "Permission denied, try running as root"
      else:
        print >> sys.stderr, "Unknown error accessing the PiGlow"

      sys.exit (1)

    self.piglow.all (0)

    self.clock = Clock (self.piglow)
    self.alert = Alert (self.piglow)
    self.in_progress = In_Progress (self.piglow)

    address = (self.cfg.HOST, self.cfg.PORT)

    serversock = socket (AF_INET, SOCK_STREAM)
    serversock.setsockopt (SOL_SOCKET, SO_REUSEADDR, 1)
    serversock.bind (address)
    serversock.listen (5)

    self.check_jobs_thread = Thread (None, self.check_jobs, None, ())
    self.socket_manager_thread = Thread (None, self.socket_manager, None, (serversock, ))

    self.start_threads ()

    while self.running == True:
      sleep (1)

    self.stop ()


  def stop (self):
    """Closes the threads and returns"""

    self.stop_threads ()
    self.piglow.all (0)


  def start_threads (self):
    """Starts the threads"""

    self.running = True

    self.check_jobs_thread.start ()
    self.socket_manager_thread.start ()


  def stop_threads (self):
    """Stops the threads"""

    self.running = False
    self.unlock ()

    try:
      self.check_jobs_thread.join ()
    except (KeyboardInterrupt, SystemExit):
      pass

    try:
      self.socket_manager_thread.join ()
    except (KeyboardInterrupt, SystemExit):
      pass


  def check_jobs (self):
    """Performs the actions in the job list"""

    while self.running == True:

      if self.quit_requested ():
        self.running = False
        break
#.........这里部分代码省略.........
开发者ID:mmawdsley,项目名称:piglow-status,代码行数:103,代码来源:piglow_status.py

示例10: PiGlow

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

piglow = PiGlow()
while True

	###All LEDs###
	#Fade all LEDs on at the same time
	piglow.all(51)
	sleep(0.1)
	piglow.all(102)
	sleep(0.1)
	piglow.all(153)
	sleep(0.1)
	piglow.all(204)
	sleep(0.1)
	piglow.all(255)
	sleep(0.5)
	
	#Fade all LEDs off at the same time
	piglow.all(255)
	sleep(0.1)
	piglow.all(204)
	sleep(0.1)
	piglow.all(153)
	sleep(0.1)
	piglow.all(102)
	sleep(0.1)
	piglow.all(51)
	sleep(0.1)
	piglow.all(0)
开发者ID:stanleyyork11,项目名称:ProjectPi,代码行数:33,代码来源:pretty.py

示例11: range

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
           # Used to define led and brightness
maxbrite = 100 # The maximum brightness to use, absolute max is 255       
y = 1      # Initialize y for main loop

m = 0      # Initialize key for led list selection loop

           # LED selection list is below
           # 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     
开发者ID:jcoffey42,项目名称:Python,代码行数:33,代码来源:pulse_02.py

示例12: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
##################################################
## Test the brightness of all the LEDs together ##
##                                              ##
## Example by Jason - @Boeeerb                  ##
##################################################

from piglow import PiGlow
from time import sleep

piglow = PiGlow()

while True:
    count = range(0, 256, +1)
    for item in count:
        if item < 256:
            piglow.all(item)
            sleep(0.01)
        if item == 256:
            break
    count = range(255, 0, -1)
    print "Brightest"
    for item in count:
        if item > 0:
            piglow.all(item)
            sleep(0.01)
        if item == 0:
            piglow.all(0)
            break
    print "Fin"
    break
开发者ID:AlexanderHems,项目名称:PiGlow,代码行数:32,代码来源:all.py

示例13: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
######################################################
## Set each colour to a brightness of your choosing ##
##                                                  ##
## Example by Jason - @Boeeerb                      ##
######################################################

from piglow import PiGlow

piglow = PiGlow()

val = input("White: ")
piglow.white(val)

val = input("Blue: ")
piglow.blue(val)

val = input("Green: ")
piglow.green(val)

val = input("Yellow: ")
piglow.yellow(val)

val = input("Orange: ")
piglow.orange(val)

val = input("Red: ")
piglow.red(val)

val = input("All: ")
piglow.all(val)
开发者ID:AlexanderHems,项目名称:PiGlow,代码行数:32,代码来源:test.py

示例14: PiGlow

# 需要导入模块: from piglow import PiGlow [as 别名]
# 或者: from piglow.PiGlow import all [as 别名]
#!/usr/bin/python
from time import sleep
from piglow import PiGlow

piglow = PiGlow()
piglow.all(0)
# the police
for i in range(1, 20):
  piglow.all(0)
  piglow.blue(100)
  sleep(.2)
  piglow.all(0) 
  piglow.red(100)
  sleep(.2)

piglow.all(0)
piglow.all(200)
piglow.all(0)
开发者ID:AdamOssenford,项目名称:piglow,代码行数:20,代码来源:popo.py


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