Rev 2.0.8: Bug of 'digitalRead'

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Rev 2.0.8: Bug of 'digitalRead'

Post 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
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Rev 2.0.8: Bug of 'digitalRead'

Post by p0lyg0n1 »

Found it! there is an inverted logic now if you call digitalRead with constant parameter. Will fix it...
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Re: Rev 2.0.8: Bug of 'digitalRead'

Post by droll »

I can confirm that the issue has been corrected in 2.0.9.
Post Reply