rjbatista / tm1638-library

Automatically exported from code.google.com/p/tm1638-library
141 stars 76 forks source link

receive function is sampling at the wrong clock edge #47

Open FrankBuss opened 5 years ago

FrankBuss commented 5 years ago

I've used a logic analyzer to capture the DIO pin when receiving data with a TM1638, see here: tm1638 This was when pressing one key. As you can see, the DIO pin is changed on the falling edge of the clock. So you should move the digitalRead(dataPin)) in TM16XX.cpp after the digitalWrite(clockPin, HIGH) line, because then the data line has enough time to get stable, regardless of the clock speed (if within the maximum allowed 1 MHz, which is also not guaranteed in the library with very fast new Arduinos), and it would work more reliable even with the recommended 10k pullup resistors.

rjbatista commented 5 years ago

Thank you for your analysis. Unfortunately, I have very little time these days to pick this up. I'll try to get some free time to dedicate to this - update the library, pickup a few fixes and I'll look into your suggestion.

Thank you!