Skip to content

Commit

Permalink
new global ref fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Zotti authored and Ryan Zotti committed Sep 19, 2016
1 parent 92593ac commit 1f0a1d2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions range_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@



def calculate_distance():
TRIG = 2
ECHO = 3
def calculate_distance(ECHO,TRIG):
# Set output pin to low
GPIO.output(TRIG, False)

Expand All @@ -36,7 +34,7 @@ def calculate_distance():
GPIO.setup(ECHO, GPIO.IN)
while True:
try:
distance = calculate_distance()
distance = calculate_distance(ECHO,TRIG)
print("Distance:", distance, "cm")
except KeyboardInterrupt:
sys.exit(0)
Expand Down

0 comments on commit 1f0a1d2

Please sign in to comment.