Analysis comment: Arduino GPIO Read on output pins returns stale Low#2551
Draft
Copilot wants to merge 1 commit into
Draft
Analysis comment: Arduino GPIO Read on output pins returns stale Low#2551Copilot wants to merge 1 commit into
Copilot wants to merge 1 commit into
Conversation
Copilot
AI
changed the title
[WIP] Fix GPIO read issue in ConfigurableFirmata on Arduino Uno
Analysis comment: Arduino GPIO Read on output pins returns stale Low
Jun 2, 2026
Contributor
|
@pgrawehr you may like this or not, decision is yours ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported on Arduino Uno R3 + ConfigurableFirmata 3.3: after
pin.Toggle()the LED turns on, butpin.Read()still returnsLow.No code changes — per the agent instruction, this PR records an analysis of whether
Toggleshould work on this board.Findings (
src/devices/Arduino/ArduinoGpioControllerDriver.cs)Toggleworks, even without a priorWrite.OpenPinseeds_pinValues[pin] = Low, andToggleis implemented asWrite(pin, !_pinValues[pin]), so the first toggle correctly drives the pin High.Readon an output pin is broken.Readalways delegates to_device.ReadDigitalPin, which returns the value sampled from the digital input port. ConfigurableFirmata only auto-reportsDIGITAL_MESSAGEfor ports that have at least one input-configured pin; on a pure-output port the cached port stays0, soRead()returnsLowregardless of what was last written.GpioPin.Read()contract: "If the pin is configured as an output, this value is the last value written to the pin."Suggested fix (not applied here)
Short-circuit
Readfor output pins to return the cached written value:Happy to follow up with a separate PR implementing this if reviewers agree.