Skip to content

Commit 29b9036

Browse files
author
Mikey Sklar
committed
linted and runs smoothly
1 parent 6d53f87 commit 29b9036

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed
Binary file not shown.
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
# Example for RC timing reading for Raspberry Pi
22
# using CircuitPython Libraries
33

4-
import os
54
import time
65
import board
76
from digitalio import DigitalInOut, Direction
87

98
def RCtime (RCpin):
10-
reading = 0
11-
12-
# setup pin as output and direction low value
13-
rc = DigitalInOut(RCpin)
14-
rc.direction = Direction.OUTPUT
15-
rc.value = False
9+
reading = 0
1610

17-
time.sleep(0.1)
11+
# setup pin as output and direction low value
12+
rc = DigitalInOut(RCpin)
13+
rc.direction = Direction.OUTPUT
14+
rc.value = False
1815

19-
# setup pin as input and wait for low value
20-
rc = DigitalInOut(RCpin)
21-
rc.direction = Direction.INPUT
16+
time.sleep(0.1)
2217

23-
# This takes about 1 millisecond per loop cycle
24-
while ( rc.value == False ):
25-
reading += 1
26-
return reading
18+
# setup pin as input and wait for low value
19+
rc = DigitalInOut(RCpin)
20+
rc.direction = Direction.INPUT
2721

28-
while True:
29-
result = RCtime(board.D18) # Read RC timing using pin #18
30-
print(result)
22+
# This takes about 1 millisecond per loop cycle
23+
while rc.value is False:
24+
reading += 1
25+
return reading
26+
27+
while True:
28+
result = RCtime(board.D18) # Read RC timing using pin #18
29+
print(result)

0 commit comments

Comments
 (0)