fix missing the first bit in HC589 shift in (#2448)

This commit is contained in:
Nguyen Hong Thiet 2019-02-14 19:11:08 +07:00 committed by Me No Dev
parent 71ec3c3e31
commit c0345eafbf

View File

@ -25,11 +25,12 @@ uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) {
uint8_t i;
for(i = 0; i < 8; ++i) {
digitalWrite(clockPin, HIGH);
//digitalWrite(clockPin, HIGH);
if(bitOrder == LSBFIRST)
value |= digitalRead(dataPin) << i;
else
value |= digitalRead(dataPin) << (7 - i);
digitalWrite(clockPin, HIGH);
digitalWrite(clockPin, LOW);
}
return value;