Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (19 sloc) 616 Bytes
# Example for RC timing reading for Raspberry Pi
# using CircuitPython Libraries
import time
import board
from digitalio import DigitalInOut, Direction
RCpin = board.D18
while True:
with DigitalInOut(RCpin) as rc:
reading = 0
# setup pin as output and direction low value
rc.direction = Direction.OUTPUT
rc.value = False
# setup pin as input and wait for low value
rc.direction = Direction.INPUT
# This takes about 1 millisecond per loop cycle
while rc.value is False:
reading += 1
You can’t perform that action at this time.