Day: April 18, 2019

SR04 program

import RPi.GPIO as gpio import time def distance(measure=’cm’): try: gpio.setmode(gpio.BOARD) gpio.setup(12, gpio.OUT) gpio.setup(16, gpio.IN) gpio.output(12, False) while gpio.input(16) == 0: nosig = time.time() while gpio.input(16) == 1: sig = time.time() tl = […]