Hello.
I assembled a circuit on a protoboard to check "uint32_t TM1637::getButtons()" on a TM1637 but it is not working with the actual library code.
Then I checked clock and data signals as in the pictures below. It seems the circuit is working.
5.bmp
4.bmp
What I saw in the datasheet of TM1637, TM1638 and TM1640 and the oscilloscope says the same is that data signal is available after rising edge of clock, and then I corrected "byte TM16xx::receive()" to make "digitalRead()" after clock rising edge. Now it is working.
Before submitting a pull request I came to check if it seems reasonable to make the correction below at "byte TM16xx::receive()".
for (int i = 0; i < 8; i++) {
temp >>= 1;
digitalWrite(clockPin, LOW);
bitDelay(); // NOTE: on TM1637 reading keys should be slower than 250Khz (see datasheet p3)
digitalWrite(clockPin, HIGH);
bitDelay();
if (digitalRead(dataPin)) {
temp |= 0x80;
}
}
Hope it helps someone else because it corrected my case.
Hello.
I assembled a circuit on a protoboard to check "uint32_t TM1637::getButtons()" on a TM1637 but it is not working with the actual library code.
Then I checked clock and data signals as in the pictures below. It seems the circuit is working.
5.bmp
4.bmp
What I saw in the datasheet of TM1637, TM1638 and TM1640 and the oscilloscope says the same is that data signal is available after rising edge of clock, and then I corrected "byte TM16xx::receive()" to make "digitalRead()" after clock rising edge. Now it is working.
Before submitting a pull request I came to check if it seems reasonable to make the correction below at "byte TM16xx::receive()".
for (int i = 0; i < 8; i++) {
temp >>= 1;
}
Hope it helps someone else because it corrected my case.