Skip to content

Print function doesn't print the GPIO state correctly. #5186

@waiweng83

Description

@waiweng83

CircuitPython version

Adafruit CircuitPython 7.0.0-alpha.6-103-gf9f106b58 on 2021-08-20; Cytron Maker Pi RP2040 with rp2040

Code/REPL

import board
import digitalio
import time

button = digitalio.DigitalInOut(board.GP20)
button.direction = digitalio.Direction.INPUT

led = digitalio.DigitalInOut(board.GP0)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = not button.value
    print(button.value)
    
    #time.sleep(0.1)

Behavior

The function print(button.value) doesn't print out the GPIO state correctly if I commented out the time.sleep(0.1).
It works fine if the 0.1s delay is there.

In both cases, the LED does react correctly to the button's state.

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrp2040Raspberry Pi RP2040

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions