Skip to content

PulseIn crashes if there are two of them #4945

@dmcomm

Description

@dmcomm

Firmware

Adafruit CircuitPython 7.0.0-alpha.3-452-g8a5a7457a on 2021-06-29; Raspberry Pi Pico with rp2040

Code/REPL

import board
import digitalio
import pulseio
import time

#GP0 to GP1; GP2 grounded

print("start")
digitalOut = digitalio.DigitalInOut(board.GP0)
digitalOut.direction = digitalio.Direction.OUTPUT
time.sleep(5)

print("creating PulseIns")
pulsesIn1 = pulseio.PulseIn(board.GP1, maxlen=20)
pulsesIn2 = pulseio.PulseIn(board.GP2, maxlen=20)
time.sleep(3)

print("high")
digitalOut.value = True

while True:
    print(".", end="")
    time.sleep(1)

Behavior

After "high", the USB connection is dropped. If I comment out the pulsesIn2 line, it prints the dots as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions