Skip to content

writing LOW to a digital input pin blocks subsequent digitalRead attempts #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
soundanalogous opened this issue Oct 24, 2015 · 3 comments · Fixed by #101
Closed

writing LOW to a digital input pin blocks subsequent digitalRead attempts #56

soundanalogous opened this issue Oct 24, 2015 · 3 comments · Fixed by #101

Comments

@soundanalogous
Copy link

I noticed while trying to add Arduino Zero support for Firmata that the following line fails: https://github.com/firmata/arduino/blob/master/examples/StandardFirmata/StandardFirmata.ino#L266.
After that point, digital input will not work on that pin (it's not permanently broken as in fried input pin or anything like that though). This has never been an issue for other architectures.

One one hand this points out that I need to update the Firmata implementation to use INPUT_PULLUP, something I should have probably added long ago. On the other hand this is an inconsistency so just calling that out.

This may be the same issue as #28.

@soundanalogous
Copy link
Author

The following does not work on SAMD boards either:

byte pin = 2;
pinMode(pin, INPUT);
digitalWrite(pin, HIGH); // enable pull-ups

// some time later
digitalRead(pin); // does not work

However this works (as expected):

byte pin = 2;
pinMode(pin, INPUT_PULLUP);

// some time later
digitalRead(pin); // value is readable

Personally I don't mind this and think it's the best way to go forward, but it was unexpected as it does work on all non SAMD architectures (including SAM) so the Arduino pinMode and digitalRead documentation should be updated for Zero if this change is intentional.

@aethaniel
Copy link
Contributor

this patch could maybe fix your issue: #41

@sandeepmistry
Copy link
Contributor

@soundanalogous AVR compatible behaviour should be maintained if possible.

I've submitted #101 to resolve the issue you mentioned in #56 (comment). Please try it out if you have time.

mattairtech added a commit to mattairtech/ArduinoCore-samd that referenced this issue Mar 30, 2016
@agdl agdl closed this as completed in #101 Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants