├── Idocode2019.mp4 └── config.py /Idocode2019.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fullzer4/Projeto-Bone-Deficiente-Visual/3b2fd44eb3cc138364fec0de6ba72e48604b78ca/Idocode2019.mp4 -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | #def sensor() 2 | 3 | import RPi.GPIO as GPIO 4 | import time 5 | GPIO.setmode(GPIO.BCM) 6 | GPIO.setwarnings(False) 7 | 8 | global pinoTrigger = 17 9 | global pinoEcho = 18 10 | global GPIO.setup(pinoTrigger, GPIO.OUT) 11 | global GPIO.setup(pinoEcho, GPIO.IN) 12 | 13 | def sensor(): 14 | try: 15 | while True: 16 | GPIO.output(pinoTrigger,False) 17 | time.sleep(1) 18 | GPIO.output(pinoTrigger,True) 19 | time.sleep(0.0001) 20 | GPIO.output(pinoTrigger,False) 21 | tempoI = time.time() 22 | while GPIO.input(pinoecho)==0: 23 | tempoI = time.time() 24 | while GPIO.input(pinoecho)==1: 25 | tempoF = time.time() 26 | 27 | tempocorrido = tempoF - tempoI 28 | distancia = (tempocorrido)/2 * 34326 29 | 30 | print("Distancia: ",distancia) 31 | return(distancia) 32 | time.sleep(0.5) 33 | 34 | while True: 35 | if sensor() < 80: 36 | GPIO.output(buzina,True) 37 | time.sleep(30) 38 | GPIO.output(buzina,False) 39 | --------------------------------------------------------------------------------