Skip to content
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

Check pin mode is set correctly for analog read and digital write #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

WillB97
Copy link
Contributor

@WillB97 WillB97 commented Aug 6, 2024

No description provided.

Copy link
Member

@RealOrangeOne RealOrangeOne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good in principle, just a nit comment

Comment on lines +130 to +137
if (mode != OUTPUT) {
if (mode == INPUT) {
Serial.print("NACK:Digital write is not supported in INPUT\n");
} else {
Serial.print("NACK:Digital write is not supported in INPUT_PULLUP\n");
}
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Remove the outer if to make it clearer what's happening.

Same below.

Suggested change
if (mode != OUTPUT) {
if (mode == INPUT) {
Serial.print("NACK:Digital write is not supported in INPUT\n");
} else {
Serial.print("NACK:Digital write is not supported in INPUT_PULLUP\n");
}
return;
}
if (mode == INPUT) {
Serial.print("NACK:Digital write is not supported in INPUT\n");
return;
} else if (mode == INPUT_PULLUP) {
Serial.print("NACK:Digital write is not supported in INPUT_PULLUP\n");
return;
}

@WillB97 WillB97 requested a review from 8BitJosh August 30, 2024 20:07
@WillB97 WillB97 linked an issue Aug 30, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate pin mode on reads and writes
2 participants