• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python webiopi.debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: checkProg

def checkProg(gpio, rank=None):
    try:
        if rank is None:
            id = str(gpio) + '-' + "deact"
            job = sched.get_job(id)
            #webiopi.debug("job: %s" % job)
            return job
        else:
            jobs = []
            # Get main job
            id = str(gpio) + '-' + rank
            job = sched.get_job(id)
            if job:
                jobs.append(job)
            # Get sons job
            for job in sched.get_jobs():
                result = re.match(id + "\-.+$", job.id)
                if result:
                    # LOGIC if job.id match str(gpio) + '-' + rank + '-' *
                    webiopi.debug("job: %s" % job)
                    #if job.args[2] == gpio and job.args[1] == rank:
                    jobs.append(job)
            #webiopi.debug("jobs: %s" % jobs)
            if jobs:
                return jobs
    except:
        webiopi.exception("! error checking prog ! %s %s" % (sys.exc_info()[0], sys.exc_info()[1]))
开发者ID:sn0oz,项目名称:eziopi,代码行数:27,代码来源:command.py


示例17: destroy

def destroy():
    webiopi.debug("Script with macros - Destroy")
    # Reset GPIO functions
    GPIO.setFunction(RED, GPIO.IN)
    GPIO.setFunction(GREEN, GPIO.IN)
    GPIO.setFunction(BLUE, GPIO.IN)
    GPIO.setFunction(SWITCH, GPIO.IN)
开发者ID:PaulFSherwood,项目名称:python,代码行数:7,代码来源:script01.py


示例18: setup

def setup():
    webiopi.debug("Script with macros - Setup")
    # Setup GPIOs
    GPIO.setFunction(RED, GPIO.PWM)
    GPIO.setFunction(GREEN, GPIO.PWM)
    GPIO.setFunction(BLUE, GPIO.PWM)
    GPIO.setup(SWITCH, GPIO.IN, pull_up_down=GPIO.PUD_UP)
开发者ID:PaulFSherwood,项目名称:python,代码行数:7,代码来源:script01.py


示例19: Relaythread

def Relaythread(pin,status,sec,delay):
  relay = relay1
  #Select relay object and set logic pin
  if int(pin) <= 8:
    relay = relay1
    inPin = int(pin)-1
  elif int(pin) <= 16:
    relay = relay2
    inPin = int(pin)-9 
  elif int(pin) <= 24:
    relay = relay3
    inPin = int(pin)-17 
  else:
    webiopi.debug(tempList[0] + " is not a valid command")
    return "ERROR - " + tempList[0] + " is not a valid command"
    
  #Handle delay in needed
  if (str(delay) != "0"):
    webiopi.sleep(float(delay))
    
  #Write desired status
  webiopi.debug("Writing to pin " + str(inPin))
  relay.digitalWrite(inPin, status)
  
  #If interval needed then wait and toggle
  if (str(sec) != "0"):
    webiopi.sleep(float(sec))
    if (status == ON):
      relay.digitalWrite(inPin, OFF)
    else:
      relay.digitalWrite(inPin, ON)
开发者ID:Thomas-Brothers-Workshop,项目名称:HalloweenPi,代码行数:31,代码来源:cmdscript2014.py


示例20: setup

def setup():
    webiopi.debug("Blink script - Setup")
    # Setup GPIOs

    GPIO.setFunction(LED0, GPIO.OUT)
    GPIO.setFunction(RELAY1, GPIO.OUT)
    GPIO.setFunction(RELAY2, GPIO.OUT)
开发者ID:Mlvtrglvn,项目名称:add_proto,代码行数:7,代码来源:script.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python webiopi.sleep函数代码示例发布时间:2022-05-26
下一篇:
Python webinterface.PYLOAD类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap