Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # Teste de tempo do capacitor
- # Programa fica em loop atΓ© executar CRTL+c ou kill no processo
- import RPi.GPIO as GPIO
- import time
- GPIO.setwarnings(False)
- GPIO.setmode(GPIO.BCM)
- def RCtime (RCpin):
- reading = 0
- GPIO.setup(RCpin, GPIO.OUT)
- GPIO.output(RCpin, GPIO.LOW)
- time.sleep(0.1)
- GPIO.setup(RCpin, GPIO.IN)
- while (GPIO.input(RCpin) == GPIO.LOW):
- reading += 1
- return reading
- while True:
- print RCtime(23)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement