Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions light_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#define the pin that goes to the circuit
pin_to_circuit = 7
max_count = 100000

def rc_time (pin_to_circuit):
count = 0
Expand All @@ -26,6 +27,8 @@ def rc_time (pin_to_circuit):
#Count until the pin goes high
while (GPIO.input(pin_to_circuit) == GPIO.LOW):
count += 1
if count == max_count:
break

return count

Expand Down