我是使用B+的RPI
這幾天寫了一個程式
def windspeed():
while True:
count = 0
start = time.time()
status = GPIO.input(GPIO_ECHO)
while count < 100:
if status != GPIO.input(GPIO_ECHO)
count +=1
status = GPIO.input(GPIO_ECHO)
end = time.time()
eclipsed = end - start
print eclipsed