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


Python webiopi.debug函数代码示例

本文整理汇总了Python中webiopi.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: update

 def update(self):
     self.status = GPIO.digitalRead(self.inputBCM)
     webiopi.debug('Switch read as {0} now and {1} last'.format(self.status, self.lastStatus))
     if (self.status != self.lastStatus && not self.status):
         self.lightSet.toggle()
     self.lastStatus = self.status
     self.lightSet.update()
开发者ID:valurv,项目名称:fiatlux,代码行数:7,代码来源:LightControl.py

示例2: destroy

def destroy():
    webiopi.debug("Script with macros - Destroy")
    # GPIO関数のリセット(入力にセットすることで行う)
    GPIO.setFunction(PWM1, GPIO.IN)
    GPIO.setFunction(PWM2, GPIO.IN)
    GPIO.setFunction(PWM3, GPIO.IN)
    GPIO.setFunction(PWM4, GPIO.IN)
开发者ID:karaage0703,项目名称:m2_robot,代码行数:7,代码来源:script.py

示例3: destroy

def destroy():
    webiopi.debug("Script with macros - Destroy")
    # Reset GPIO functions
    GPIO.setFunction(IC1A, GPIO.IN)
    GPIO.setFunction(IC1B, GPIO.IN)
    GPIO.setFunction(IC2A, GPIO.IN)
    GPIO.setFunction(IC2B, GPIO.IN)
开发者ID:yongsukki,项目名称:clickpirc,代码行数:7,代码来源:script.py

示例4: setup

def setup():
    webiopi.debug("Script with macros - Setup")
    # Setup GPIOs
    GPIO.setFunction(17, GPIO.OUT)
    GPIO.setFunction(0, GPIO.OUT)

    GPIO.output(17, GPIO.HIGH)
开发者ID:eunwho,项目名称:webio,代码行数:7,代码来源:PowerMeterTest.py

示例5: measureWU

def measureWU(api_key, index, lat, lon):
    # get WeatherUnderground data
    try:
        webiopi.debug("Starting WU measure")
        url = "http://api.wunderground.com/api/" + api_key + "/conditions/q/" + lat + "," + lon + ".json"
        r = requests.get(url, timeout=2)
        data = r.json()
        dat = data["current_observation"]
        try:
            temp = str(round(dat["temp_c"], 1))
        except:
            temp = "U"
        #hr = str(round(dat["relative_humidity"], 1))
        match = re.search('([\d\.]+)%', dat["relative_humidity"])
        if match:
            hr = match.group(1)
        else:
            hr = "U"
        match = re.search('([\d\.]+)', dat["precip_1hr_metric"])
        if match:
            rain = match.group(1)
        else:
            rain = "U"
        #match = re.search('([\d\.]+)%', dat["clouds"]["all"])
        clouds = "0"
    except:
        temp = "U"
        hr = "U"
        clouds = "U"
        rain = "U"
        webiopi.info("! WU request error ! %s %s" % (sys.exc_info()[0], sys.exc_info()[1]))
    finally:
        values = [temp, hr, clouds, rain]
        webiopi.debug("WU values = %s" % values)
        return values[index]
开发者ID:sn0oz,项目名称:eziopi,代码行数:35,代码来源:status.py

示例6: measureDHT

def measureDHT(DHTtype, gpio, index):
    try:
        script = os.path.join(eziopi_dir, "scripts/adafruit_dht")
        tries = 5
        for i in range(tries):
            val = str(subprocess.check_output([script, DHTtype, str(gpio)]))
            match = re.search('Temp.+\s([\d\.]+)\s.+Hum.+\s([\d\.]+)\s%', val)
            if match:
                temp, hr = match.group(1), match.group(2)
                webiopi.debug("DHT22 measure %s: temp=%s hr=%s" % (str(i+1), temp, hr))
                break
            else:
                # Erreur mesure gpioDHT22
                if i == tries-1:
                    temp = "U"
                    hr = "U"
                    webiopi.info("! DHT22 error after %s tries ! - stop trying" % str(i+1))
                else:
                    time.sleep(2)
    except:
        temp = "U"
        hr = "U"
        webiopi.exception("! DHT22 error ! %s" % sys.exc_info()[1])
    finally:
        values = [temp, hr]
        return values[index]
开发者ID:sn0oz,项目名称:eziopi,代码行数:26,代码来源:status.py

示例7: turn_on_pc

 def turn_on_pc(self):
     try:
         webiopi.debug(self.address)
         resp = requests.get(self.address+  "/pc_on")
     except:
         webiopi.debug("connection error with turn_on_pc")
         return 0
开发者ID:OdysLam,项目名称:GLaDOS-project,代码行数:7,代码来源:esp.py

示例8: ResetTempRange

def ResetTempRange():
    webiopi.debug("Reset All Temp Range Macro...")
    global tShopHigh
    global tShopLo
    global tGpuHigh
    global tGpuLow
    global tCpuHigh
    global tCpuLow
    fahrenheit = t.getFahrenheit()
    GPUfahrenheit = float(get_gpu_temp())
    CPUfahrenheit = float(get_cpu_temp())
    tShopHigh = fahrenheit
    tShopLow = fahrenheit
    tGpuHigh = GPUfahrenheit
    tGpuLow = GPUfahrenheit
    tCpuHigh = CPUfahrenheit
    tCpuLow = CPUfahrenheit
    # LCD Background Cyan
    GPIO.pwmWrite(RED, 1.0)
    GPIO.pwmWrite(GREEN, 0.0)
    GPIO.pwmWrite(BLUE, 0.0)
    # Display current temperature on LCD display
    lcd.lcd_byte(lcd.LCD_LINE_1, lcd.LCD_CMD)
    lcd.lcd_string("Temp Ranges Reset")
    lcd.lcd_byte(lcd.LCD_LINE_2, lcd.LCD_CMD)
    lcd.lcd_string("( HTTP Request )")
开发者ID:arizno,项目名称:PiDuinoCNC,代码行数:26,代码来源:script.py

示例9: CoilCtrl

def CoilCtrl(out):
    webiopi.debug("Coil : " + str(out))

    GPIO.output(17, GPIO.HIGH)
    
    if out == 'on':
        buff = [0x01, 0x06, 0x01, 0xf4, 0xff, 0x00]
        crc = CalcCrcFast(buff, len(buff))
        buff = buff + crc

        webiopi.debug(bytes(buff))
        size = ser.write(bytes(buff))
        webiopi.debug(size)
    else:
        buff = [0x01, 0x06, 0x01, 0xf4, 0x00, 0xff]
        crc = CalcCrcFast(buff, len(buff))
        buff = buff + crc

        webiopi.debug(bytes(buff))
        size = ser.write(bytes(buff))
        webiopi.debug(size)

    x = 0.0; 
    y = 1.0; 
    z = 0.0;  

    for i in range(0, 1500) :
        z += math.sin(y) * math.sin(y)
        y = y - 0.001
        x = x + 0.001
    GPIO.output(17, GPIO.LOW)
    
    return 'OK' 
开发者ID:eunwho,项目名称:webio,代码行数:33,代码来源:PowerMeterTest.py

示例10: setup

def setup():
    webiopi.debug("Blink script - Setup")
    # Setup GPIOs
    GPIO.setFunction(LED0, GPIO.PWM)
    # GPIO.setFunction(LED1, GPIO.OUT)

    GPIO.pwmWrite(LED0, 0.5)      # set to 50% ratio
开发者ID:mystastian,项目名称:thermostat,代码行数:7,代码来源:script3.py

示例11: destroy

def destroy():
    webiopi.debug("Script with macros - Destroy")
    # Reset GPIO functions
    GPIO.setFunction(M1_A, GPIO.IN)
    GPIO.setFunction(M1_B, GPIO.IN)
    GPIO.setFunction(M2_A, GPIO.IN)
    GPIO.setFunction(M2_B, GPIO.IN)
开发者ID:rasplay,项目名称:clickpirc,代码行数:7,代码来源:rc_script_2.py

示例12: setup

def setup():
    webiopi.debug("setting up in script")
    GPIO.setFunction(17, GPIO.OUT)
    GPIO.setFunction(22, GPIO.OUT)
    pygame.mixer.init(44100, -16, 1, 1024)
    if AMBIANCE:
        startAmbiance()
开发者ID:jbaragry,项目名称:halloweenHead,代码行数:7,代码来源:headWebIOPiClient.py

示例13: setSchedule

def setSchedule(newSchedule):
    global schedule
    global currentShow
    global showStartTime
    global fadeOutShow

    del schedule[:]
    programs = newSchedule.split(";")

    for p in programs:
        parts = p.split(":");
        newShow = Show()
        newShow.program = urllib.parse.unquote(parts[0])
        newShow.length = int(parts[1])
        webiopi.debug("adding show '" + newShow.program + "' for " + str(newShow.length) + " seconds");
        schedule.append(newShow)

        # append a fadeOut for every program... fadeIn is added by the loop above 
        schedule.append(fadeOutShow)

    currentShow = -1
    showStartTime = int(time.time())

    # send fade out to end the current thing smoothly
    serial.writeString('push fadeout')
    serial.writeString("\r")

    return 1 
开发者ID:gerstle,项目名称:TubeController,代码行数:28,代码来源:lightTubes.py

示例14: loop

def loop():
    global schedule
    global currentShow
    global showStartTime

    #webiopi.debug("loop... schedule count: " + str(len(schedule)))
    if len(schedule) > 0:
        #webiopi.debug("running schedule")
        currentTime = int(time.time())
        if (currentShow == -1) or ((currentTime - showStartTime) > schedule[currentShow].length):
            # currentShow == -1 means we're starting a schedule for the first time... give time to fade out of previous
            if (currentShow == -1):
                time.sleep(2)
            
            currentShow += 1

            if (currentShow >= len(schedule)):
                currentShow = 0

            showStartTime = currentTime
            webiopi.debug("next show: " + schedule[currentShow].program + " for " + str(schedule[currentShow].length) + " seconds");

            if (schedule[currentShow].program != 'fadeout'):
                serial.writeString("program ")
            else:
                serial.writeString("push ")

            serial.writeString(schedule[currentShow].program)
            if (schedule[currentShow].program != 'fadeout'):
                serial.writeString(" fadein")
            serial.writeString("\r")

    webiopi.sleep(1)
开发者ID:gerstle,项目名称:TubeController,代码行数:33,代码来源:lightTubes.py

示例15: destroy

def destroy():
    webiopi.debug("Script with macros - Destroy")
    # Reset GPIO functions
    GPIO.setFunction(SWITCH, GPIO.IN)
    GPIO.setFunction(SERVO, GPIO.IN)
    GPIO.setFunction(LED0, GPIO.IN)
    GPIO.setFunction(LED1, GPIO.IN)
开发者ID:LeMaker,项目名称:webio-lemaker,代码行数:7,代码来源:script.py


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