gbz_power_monitor.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:GBZ-Power-Monitor_PB 作者: Camble 项目源码 文件源码
def main():
  #if the Low Battery LED is active when the program launches, handle it
  if GPIO.input(batteryGPIO) is 0:
    lowBattery(batteryGPIO)

  #if the Power Switch is active when the program launches, handle it
  if GPIO.input(powerGPIO) is 0:
    powerSwitch(powerGPIO)

  #Add threaded event listeners for the Low Battery and Power Switch
  try:
    GPIO.remove_event_detect(batteryGPIO)
    GPIO.add_event_detect(batteryGPIO, GPIO.FALLING, callback=lowBattery, bouncetime=300)

    GPIO.remove_event_detect(powerGPIO)
    GPIO.add_event_detect(powerGPIO, GPIO.FALLING, callback=powerSwitch, bouncetime=300)
  except KeyboardInterrupt:
    GPIO.cleanup()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号