python类cleanup()的实例源码

PhotoBooth.py 文件源码 项目:raspi-photo-booth 作者: kriskbx 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def destroy():
    ledOff()
    beepOff()
    GPIO.cleanup()
com_gpio.py 文件源码 项目:StratoBalloon 作者: delattreb 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __delete__(self, instance):
        if self.importlib is not None:
            self.cleanup()
com_gpio.py 文件源码 项目:StratoBalloon 作者: delattreb 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def cleanup(self):
        if self.importlib is not None:
            GPIO.cleanup()
data.py 文件源码 项目:pibike 作者: johnjp15 项目源码 文件源码 阅读 58 收藏 0 点赞 0 评论 0
def main():
    read_25 = GPIO.input(25)

    print(read_25)

    GPIO.cleanup()
###




#############################
ObstacleRL.py 文件源码 项目:RaspberryPi-Robot 作者: timestocome 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def hard_left(t=wheel_pulse):
    gpio.output(forward_right, gpio.HIGH)
    gpio.output(reverse_left, gpio.HIGH)

    sleep(t)
    gpio.output(forward_right, gpio.LOW)
    gpio.output(reverse_left, gpio.LOW)



##########################################################################
# cleanup
##########################################################################
ObstacleRL.py 文件源码 项目:RaspberryPi-Robot 作者: timestocome 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def cleanup():

    gpio.cleanup()




##########################################################################
# network
##########################################################################
ObstacleRLServos.py 文件源码 项目:RaspberryPi-Robot 作者: timestocome 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def cleanup():

    gpio.cleanup()

    pwm.set_pwm(channel, 0, servo_center)
    pwm = None





##########################################################################
# network
##########################################################################
FindDistance.py 文件源码 项目:RaspberryPi-Robot 作者: timestocome 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def cleanup(self):
        gpio.cleanup()



###################################################
# test class
MoveClearRobot.py 文件源码 项目:RaspberryPi-Robot 作者: timestocome 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def cleanup(self):

        gpio.cleanup()

        self.pwm.set_pwm(0, 0, servo_center)
        self.pwm = None


##################################################################
# test
findDistance.py 文件源码 项目:RaspberryPi-Robot 作者: timestocome 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def cleanup(self):
        gpio.cleanup()



###################################################
# test class
photobooth_main.py 文件源码 项目:photobooth 作者: eoghan-c 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def tidy_up(self):
        # NOTE: This was the __del__ method, but seems more reliable to call explicitly
        print "Tidying up PhotoBooth instance"
        ButtonHandler().light_button_leds('slr', False) # Turn off all LEDs
        pygame.quit()  # End our pygame session
        GPIO.cleanup() # Make sure we properly reset the GPIO ports we've used before exiting

        # Restore monitor blanking (TODO can we store previous values?)
        os.system("setterm -blank 30 -powerdown 30")
RFID.py 文件源码 项目:nfcmusik 作者: ehansis 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def cleanup(self):
        """
        Calls stop_crypto() if needed and cleanups GPIO.
        """
        if self.authed:
            self.stop_crypto()
        GPIO.cleanup()
step.py 文件源码 项目:pi-thrum 作者: arosspope 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def cleanup(self):
        """
        Cleanup method which should be invoked before program exit
        """
        # Destroy pygame objects and de-init GPIO pins
        pygame.quit()
        GPIO.output(self.__LED, GPIO.LOW)
        GPIO.cleanup()
GpioPower.py 文件源码 项目:Rpi-envMonitor 作者: conanwhf 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _GPIO_Power_UnRegist(pins):
    GPIO.cleanup(pins)
    return
DHT11.py 文件源码 项目:Rpi-envMonitor 作者: conanwhf 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __exit__(self):
        GPIO.cleanup()
PCF8591.py 文件源码 项目:Rpi-envMonitor 作者: conanwhf 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __exit__(self):
        self.bus.close()
        GPIO.cleanup()
initBot.py 文件源码 项目:Motion-Sensor 作者: Paco1994 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def detect(run_event):
    isDetected = False
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(11, GPIO.IN) # Set GPIO 11 pin as input
    GPIO.setup(12,GPIO.OUT)
    GPIO.setup(16,GPIO.OUT)


    while run_event.is_set():
        i=GPIO.input(11)
        if i==0:         # if don't detect signal
            #print "\033[95mNobody detected.\033[0m",i
            GPIO.output(12,GPIO.HIGH)
            GPIO.output(16,GPIO.LOW)
            isDetected = False
            time.sleep(0.1)
        if i==1 and isDetected == False:       # if detect signal
            GPIO.output(16,GPIO.HIGH)
            GPIO.output(12,GPIO.LOW)
            print "\033[92mSomeone detected.\033[0m --> " + time.strftime("%H:%M:%S")
            bot.send_message(admin, "Someone detected -->   " + time.strftime("%H:%M:%S"))
            for i in range(1, 6, 4):
                print i
                name=video(3*i, frameRate) #One video of 3 seconds and another of 15
                if (name == "error"):
                    bot.send_message (admin, "The camera is busy now.")
                else:
                    bot.send_document(admin, open(name, 'rb'))
            #bot.send_document(admin, open('media/video/' + video(3), 'rb'))
            #bot.send_document(admin, open('media/video/' + video(15), 'rb'))
            print "ya"

            isDetected = True
    GPIO.cleanup()
hydroponics.py 文件源码 项目:hydroponics 作者: tpudlik 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __exit__(self, type, value, traceback):
        GPIO.cleanup()
hydroponics.py 文件源码 项目:hydroponics 作者: tpudlik 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __exit__(self, type, value, traceback):
        print "GPIO.cleanup()"
raspberrypiplatform.py 文件源码 项目:AlexaPi 作者: alexa-pi 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def setup(self):
        GPIO.setwarnings(False)
        GPIO.cleanup()
        GPIO.setmode(GPIO.BCM)

        super(RaspberrypiPlatform, self).setup()


问题


面经


文章

微信
公众号

扫码关注公众号