We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Under the following conditions, the library uses an analog read of pin A0 to seed the pseudorandom number generator:
ArduinoIoTCloud/src/utility/time/NTPUtils.cpp
Line 101 in d4ae0a3
This analog read puts the pin into INPUT mode.
INPUT
In addition to use as a ADC, analog pins may be used as digital output pins by setting the pin mode to OUTPUT.
OUTPUT
🐛 If the user is using pin A0 as an output, the library will break their sketch by changing the pin mode.
setup
ArduinoCloud.getInternalTime()
ArduinoCloud.update()
pinMode(A0, OUTPUT);
loop
static unsigned long blinkTimestamp; static byte pinState; if (millis() - blinkTimestamp >= 1000) { blinkTimestamp = millis(); if (pinState == LOW) { pinState = HIGH; } else { pinState = LOW; } digitalWrite(A0, pinState); }
🐛 The pin state stops toggling.
Library does not interfere with user's ability to use pin A0 as an output.
- OR -
Library's impact on pin A0 is clearly documented.
d4ae0a3
Originally reported at https://forum.arduino.cc/t/a0-pin-behavior-uno-r4-wifi/1238998
Add the following code to the loop function of your sketch:
static bool pinModeRestored = false; // Track state to avoid unnecessary calls to the fairly slow ArduinoCloud.connected() if (!pinModeRestored && ArduinoCloud.connected()) { pinMode(ledPin, OUTPUT); pinModeRestored = true; }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the problem
Under the following conditions, the library uses an analog read of pin A0 to seed the pseudorandom number generator:
ArduinoIoTCloud/src/utility/time/NTPUtils.cpp
Line 101 in d4ae0a3
This analog read puts the pin into
INPUT
mode.In addition to use as a ADC, analog pins may be used as digital output pins by setting the pin mode to
OUTPUT
.🐛 If the user is using pin A0 as an output, the library will break their sketch by changing the pin mode.
To reproduce
setup
function of an ArduinoIoTCloud sketch that callsArduinoCloud.getInternalTime()
orArduinoCloud.update()
:pinMode(A0, OUTPUT);
loop
function of the sketch:🐛 The pin state stops toggling.
Expected behavior
Library does not interfere with user's ability to use pin A0 as an output.
- OR -
Library's impact on pin A0 is clearly documented.
Library version
d4ae0a3
Additional context
Originally reported at https://forum.arduino.cc/t/a0-pin-behavior-uno-r4-wifi/1238998
Related
Workaround
Add the following code to the
loop
function of your sketch:The text was updated successfully, but these errors were encountered: