Пример #1
0
def flash_white():

    # Turn off all, turn on blue
    piglow.clear()
    piglow.white(WHITE)
    piglow.show()
    # Leave on for 0.1 seconds
    time.sleep(0.2)

    # Leave off for 0.1 seconds
    piglow.clear()
    piglow.show()
    time.sleep(0.2)
Пример #2
0
#!/usr/bin/env python

import time
import piglow

while True:
    for x in range(100):
        piglow.leg_bar(0,x/100.0)
        piglow.leg_bar(1,x/100.0)
        piglow.leg_bar(2,x/100.0)
        piglow.white(0)
        piglow.show()
        time.sleep(0.01)
    for x in reversed(range(100)):
        piglow.leg_bar(0,x/100.0)
        piglow.leg_bar(1,x/100.0)
        piglow.leg_bar(2,x/100.0)
        piglow.white(0)
        piglow.show()
        time.sleep(0.01)
Пример #3
0
def errorStatus():
    logging.debug('Network Error')
    piglow.white(255)
    piglow.show()
Пример #4
0
	def __init__(self):
		self.configFileLocation = os.getenv('CONFFILE', self.configFileLocation)
		self.config = ConfigParser.ConfigParser()
		#Try to load config file
		
		if self.configFileLocation not in self.config.read(self.configFileLocation):
			self.configFileLocation = None
			
		#Try to set rfid input path from config file.
		try:
			self.rfidPath = self.config.get('Parkomatic', 'rfid_input_path')
		except: 
			pass
		
		#Try to set destination URL from config file.
		try:
			self.URL = self.config.get('Parkomatic', 'url')
		except:
			pass
		
		#Try to set tmp path from config file.
		try:
			self.tmpLocation = self.config.get('Parkomatic', 'tmp_path')
		except:
			pass
		
		try:
			piglow_val = self.config.get('Parkomatic', 'piglow')
			if piglow_val == "enable":
				self.piGlowEnable = True
		except:
			 pass
		
		#Try to create the tmp location if it doesn't exist
		if not os.path.exists(self.tmpLocation):
			os.makedirs(self.tmpLocation)
		
		#Make a connection to the CUPS server
		try:
			self.conn = cups.Connection()
		except:
			print "ERROR: CUPs not available"
			#Sleep for 5 seconds as repeatedly attemping to connect to CUPs seems to make it hard for cups to start initially.
			time.sleep(5)
			sys.exit(1)
			
		printers = self.conn.getPrinters()
		if len(printers) == 0:
			print "ERROR: No printers available"
			time.sleep(5)
			sys.exit(1)
		#Get the first printer in the list
		self.printer = printers.keys()[0]
		
		#Create the RFID input device
		self.rfidDevice = InputDevice(self.rfidPath)
		print "STARTED: Waiting for input."
		if self.piGlowEnable:
			piglow.auto_update = True;
			piglow.all(0)
			piglow.red(255)
			time.sleep(0.1)
			piglow.red(0)
			piglow.green(255)
			time.sleep(0.1)
			piglow.green(0)
			piglow.yellow(255)
			time.sleep(0.1)
			piglow.white(255)
			piglow.yellow(0)
			time.sleep(0.1)
			piglow.white(0)
Пример #5
0
       piglow.show()
       time.sleep(0.01)
    for x in reversed(range(100)):
       piglow.leg_bar(0, x / 100.0)
       #piglow.leg_bar(1, x / 100.0)
       #piglow.leg_bar(2, x / 100.0)
       piglow.blue(200)
       piglow.show()
       time.sleep(0.01) 
 
 elif hourlyData.icon == "snow":
   for x in range(100):
       piglow.leg_bar(0, x / 100.0)
       #piglow.leg_bar(1, x / 100.0)
       #piglow.leg_bar(2, x / 100.0)
       piglow.white(200)
       piglow.show()
       time.sleep(0.01)
    for x in reversed(range(100)):
       piglow.leg_bar(0, x / 100.0)
       #piglow.leg_bar(1, x / 100.0)
       #piglow.leg_bar(2, x / 100.0)
       piglow.white(200)
       piglow.show()
       time.sleep(0.01) 
         
 elif hourlyData.icon == "sleet":
 for x in range(100):
       piglow.leg_bar(0, x / 100.0)
       #piglow.leg_bar(1, x / 100.0)
       #piglow.leg_bar(2, x / 100.0)
Пример #6
0
    if show12hr == 1:
        if hour > 12:
            hour = hour - 12

    if currenthour != hour:
        hourcount = hour
        currenthour = hour

    arm3 = hour

    for x in range(6):
        piglow.led(13 + x, (arm3 & (1 << x)) * ledbrightness)

    arm2 = min

    for x in range(6):
        piglow.led(7 + x, (arm2 & (1 << x)) * ledbrightness)

    arm1 = sec

    for x in range(6):
        piglow.led(1 + x, (arm1 & (1 << x)) * ledbrightness)

    if hourcount != 0:
        sleep(0.5)
        piglow.white(ledbrightness)
        sleep(0.5)
        hourcount = hourcount - 1
    else:
        sleep(0.1)
Пример #7
0
	arm1 = list(binhour)
    elif armtop == "m":
        arm1 = list(binmin)
    else:
        arm1 = list(binsec)
    led01 = ledbrightness if arm1[5] == "1" else 0
    piglow.led(1,led01)
    led02 = ledbrightness if arm1[4] == "1" else 0
    piglow.led(2,led02)
    led03 = ledbrightness if arm1[3] == "1" else 0
    piglow.led(3,led03)
    led04 = ledbrightness if arm1[2] == "1" else 0
    piglow.led(4,led04)
    led05 = ledbrightness if arm1[1] == "1" else 0
    piglow.led(5,led05)
    led06 = ledbrightness if arm1[0] == "1" else 0
    piglow.led(6,led06)


    # Flash the white leds for the hour
    if hourcount != 0:
        sleep(0.5)
        if hourflash == 1:
            piglow.white(ledbrightness)
        if hourflash == 2:
            piglow.all(ledbrightness)
        sleep(0.5)
        hourcount = hourcount - 1
    else:
        sleep(0.1)
Пример #8
0
    def __init__(self):
        self.configFileLocation = os.getenv('CONFFILE',
                                            self.configFileLocation)
        self.config = ConfigParser.ConfigParser()
        #Try to load config file

        if self.configFileLocation not in self.config.read(
                self.configFileLocation):
            self.configFileLocation = None

        #Try to set rfid input path from config file.
        try:
            self.rfidPath = self.config.get('Parkomatic', 'rfid_input_path')
        except:
            pass

        #Try to set destination URL from config file.
        try:
            self.URL = self.config.get('Parkomatic', 'url')
        except:
            pass

        #Try to set tmp path from config file.
        try:
            self.tmpLocation = self.config.get('Parkomatic', 'tmp_path')
        except:
            pass

        try:
            piglow_val = self.config.get('Parkomatic', 'piglow')
            if piglow_val == "enable":
                self.piGlowEnable = True
        except:
            pass

        #Try to create the tmp location if it doesn't exist
        if not os.path.exists(self.tmpLocation):
            os.makedirs(self.tmpLocation)

        #Make a connection to the CUPS server
        try:
            self.conn = cups.Connection()
        except:
            print "ERROR: CUPs not available"
            #Sleep for 5 seconds as repeatedly attemping to connect to CUPs seems to make it hard for cups to start initially.
            time.sleep(5)
            sys.exit(1)

        printers = self.conn.getPrinters()
        if len(printers) == 0:
            print "ERROR: No printers available"
            time.sleep(5)
            sys.exit(1)
        #Get the first printer in the list
        self.printer = printers.keys()[0]

        #Create the RFID input device
        self.rfidDevice = InputDevice(self.rfidPath)
        print "STARTED: Waiting for input."
        if self.piGlowEnable:
            piglow.auto_update = True
            piglow.all(0)
            piglow.red(255)
            time.sleep(0.1)
            piglow.red(0)
            piglow.green(255)
            time.sleep(0.1)
            piglow.green(0)
            piglow.yellow(255)
            time.sleep(0.1)
            piglow.white(255)
            piglow.yellow(0)
            time.sleep(0.1)
            piglow.white(0)
Пример #9
0
#!/usr/bin/env python

import time
import piglow

while True:
    for x in range(100):
        piglow.leg_bar(0, x / 100.0)
        piglow.leg_bar(1, x / 100.0)
        piglow.leg_bar(2, x / 100.0)
        piglow.white(0)
        piglow.show()
        time.sleep(0.01)
    for x in reversed(range(100)):
        piglow.leg_bar(0, x / 100.0)
        piglow.leg_bar(1, x / 100.0)
        piglow.leg_bar(2, x / 100.0)
        piglow.white(0)
        piglow.show()
        time.sleep(0.01)