Closed MaxScorda closed 5 years ago
Thank you for your answer. Yes, it's very strange. Now it's connected to an arduino mega (clone). It was part of a complex hardware project and it's quiet difficult to connect to another arduino but i'll try. Code it's nothing special, it's a test sketch from your demo. I've attached sketch and a picture... Thank you for your help Max
Hi
I have only tested this on UNO and NANO. But I don't think its the MEGA is the issue, although it could be, in last issue someone had a problem with timing and the ESP32.
I suspect :: The TM1638 module is defective. OR different version of IC. OR most likely The module you have is using different wiring to the one I tested library on, so segments have different addresses.
It is possible there is different versions of this module on market . I note the one I have is labelled QYF-TM1638 yours has QYF-TM1638 -Ver 1.0.
Here is a workaround I think will work change this function in library , we need to swap the digit information byte around.
void TM1638plus_Model2::DisplaySegments(byte segment, byte digit) { uint8_t minupper , minlower = 0; minlower = (digit) & 0x0F; // select lower nibble minupper = (digit >> 4) & 0X0F; //select upper nibble digit = minlower << 4 | minupper; segment = (segment<<1); sendCommand(WRITE_LOC); digitalWrite(_STROBE_IO, LOW); sendData(SEG_ADR | segment); sendData(digit); digitalWrite(_STROBE_IO, HIGH); }
Let me know how you get on if it works i will make a permanent solution in a new version update. If I ran this code I can swap the data around on my module. Not sure what happens at your end.
Regards
It's a good question if there are different hardware version. As i said, i can try to connect to an Arduino Uno and see if something change. I can say i try different libraries (yours is the best :) ) and i never see digits swap Now I'm far from home for work but saturday i'll be back and I'll try new code but it seems ok. I'll try as soon as possible Thank you again Max
Here I am again, I try with a different Arduino, this one is a Uno clone and nothing to do, digits are swapped. I change function DisplaySegments and it works now. Probably QYF-TM1638 -Ver 1.0 is different... Thank you very much Max
Hi
Thanks for feedback.
I have released a new version of the Library v1.2.0 to make change permanent. Just update it in library manager. There is now a fourth parameter in the object constructor. called swapnibbles, It is set to false_ by default, for the display I Have, Set to true if you have the display wiring you have.
Readme also updated. See Note A for full details.
Regards
Hi, I see it now. Great work, I'll update the lib this evening but I'm sure it'll be right. Thank you again Max
Hi to everyone, with Model 2 Library why 8 digit display is 4 digit swapped? For example tm.DisplayStr(" helloU2", 0); show "loU2 hel" or tm.DisplayDecNum(5, 1 << 6); show "000500.00"
Thank you Max