Page 1 of 1

Rev 2.0.8: Bug of 'digitalRead'

Posted: 04 Mar 2017 20:11
by droll
The response of the 'digitalRead' command has changed between revision 2.0.7 and 2.0.8 (version from Feb 28, 2017). The command seems to behave incorrectly in revision 2.0.8.

Test case:
  • A pin (example pin 6) is configured as INPUT_PULLUP.
  • Since this pin is pulled up it is expected that 'digitalRead' returns 'high' (something different than 0), which is the case with revision 2.0.7. However with 2.0.8 the command returns 0.
  • If the pin is shorted to ground it is expected that 'digitalRead' returns 0, which is the case with revision 2.0.7. However with revision 2.0.8 the command returns 1.
Test case code:

Code: Select all

#define PIN_BUTTON1 6

void setup() {
  pinMode(PIN_BUTTON1,INPUT_PULLUP); // Control button 1
  Serial.begin(); // Status information reports
}

void loop() {
	Serial.print("But1="); 
	Serial.print(digitalRead(PIN_BUTTON1));
	Serial.print(", LOW="); 
	Serial.print(LOW);
	Serial.print(", HIGH="); 
	Serial.print(HIGH);
	Serial.println("");
	Serial.flush();
	delay(1000);
}
Output with revision 2.0.8:

The pin is not shorted to ground (=it is pulled up):

Code: Select all

But1=0, LOW=0, HIGH=1
The pin is shorted to ground:

Code: Select all

But1=1, LOW=0, HIGH=1

Re: Rev 2.0.8: Bug of 'digitalRead'

Posted: 06 Mar 2017 22:21
by p0lyg0n1
Found it! there is an inverted logic now if you call digitalRead with constant parameter. Will fix it...

Re: Rev 2.0.8: Bug of 'digitalRead'

Posted: 15 Mar 2017 15:43
by PoltoS

Re: Rev 2.0.8: Bug of 'digitalRead'

Posted: 26 Mar 2017 18:34
by droll
I can confirm that the issue has been corrected in 2.0.9.