LED&KEY module

I've had one of these http://www.alselectro.com/7-segment-led-array---key---ic-tm1638-drive.html for a while and when I tried to use it had trouble getting anything to display. So I played with it and looked for some example SPIN code to use with it but only found a couple online that didn't work for me anyway. More playing and things started to click. So I've written a few simple programs to use the basic display options and thought I would post this to help someone else trying to get started. Also included a readme with some of what I have learned. I have nowhere near learned to use this to even part of it's potential and may post more when more is known. Hope this helps someone!
Aaron

Comments

  • JonnyMacJonnyMac Posts: 6,298
    edited 2019-12-06 - 00:39:33
    After seeing your post I thought it would be something worth having a proper library for. Most of the code I encountered was for the Arduino, and most of that was, well, garbage (Why do Arduino users torture each other with bad code? :smiley: )

    Anyway, I spent a day writing what I think is a proper library for the LED&KEY.

    I've attached a demo that shows off the features:
    -- write segments to any column
    -- write a hex digit to any column
    -- write a character to any column (limited by 7-segment displays)
    -- write the state of any led -- or all at once from a single byte
    -- fill the 7-segment displays and leds with desired pattern/state
    -- write a string (limited by 7-segment displays)
    -- write a decimal value (left justified)
    -- write a right-justified decimal value
    -- write a fixed-point decimal value
    -- write variable- or fixed-width hex value
    -- write variable- or fixed-width binary value
    -- read buttons

    If anyone finds a problem with the library, please let me know.

    I have ordered the version with eight 7-segment displays and 16 buttons. Will post code for it when it arrives and I've had time to play with.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • Jon
    I got the idea to try to make use of this thing from this video
    part 3
    https://www.bing.com/videos/search?q=youtube+clough42+electronic+lead+screw&&view=detail&mid=2B6239CA4D7F38750E1B2B6239CA4D7F38750E1B&&FORM=VDRVRV
    Not to do the exact thing but to be able to switch to read several different outputs by using the buttons, indicating LEDs and 7segs.
    Thanks
    Aaron
  • JonnyMac wrote: »
    I have ordered the version with eight 7-segment displays and 16 buttons.
    Where did you find one with 16 buttons? I could only find ones with 8.

  • @Aaron That guy did a nice job on the case. I do a lot of coding for escape room puzzles and thought this board would be a good electronic lock interface. My problem with most of the Arduino code I found is that it was just fragments, not a full driver that would allow a new programmer (I'm not) to use the board to its full potential -- and do it easily. I think you'll find my driver does that.

    @David It's an eBay find. If you do a search on TM1638 (the driver chip) you'll find a bunch. Here's the one I bought (I tend to stick to US suppliers):

    -- https://www.ebay.com/itm/8-Bits-LED-Digital-tube-Module-Keyboard-Scan-and-Display-Module-TM1638-MCU/333348385691

    This version lacks the discrete LEDs of the smaller one -- that's okay with me.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • Thanks, Jon!
Sign In or Register to comment.