Advertisement
naldin

input_WHILE_POLL

May 7th, 2014
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Input teste com polling usando while
  4. # Programa fica em loop até executar CRTL+c ou kill no processo
  5.  
  6. import RPi.GPIO as GPIO
  7.  
  8. GPIO.setmode(GPIO.BCM)
  9.  
  10. SWITCH = 23
  11.  
  12. GPIO.setup(SWITCH, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) #com pull-down via sw
  13.  
  14. while 1:
  15.         while GPIO.input(SWITCH):
  16.                 print("Entrada em nivel alto")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement