Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- # -*- coding: utf-8 -*-
- import RPi.GPIO as gpio
- import time
- gpio.setmode(gpio.BCM)
- gpio.setup(23, gpio.IN, pull_up_down = gpio.PUD_DOWN)
- try:
- while True:
- if(gpio.input(23) == 1):
- print(“Botão pressionado”)
- else:
- print(“Botao desligado”)
- time.sleep(0.2)
- except:
- gpio.cleanup()
- exit()
Advertisement
Add Comment
Please, Sign In to add comment