2.9K
This was a module based on the TM1638 IC that I purchased.
The imprtant connections are as follows
data pin 3
clock pin 2
strobe pin 5
I decided to create an example that would display the button pressed on the display, you will need the library below
The library is https://github.com/Leonardoventurin/tm1638-library
Code
[codesyntax lang=”cpp”]
#include <TM1638.h> #include <TM1638QYF.h> TM1638QYF module(3, 2, 5); word mode; void setup() { module.setupDisplay(true, 7); mode = 0; } void update(TM1638QYF* module, word* mode) { word buttons = module->getButtons(); // button pressed - change mode if (buttons != 0) { *mode = buttons >> 1; if (*mode < 128) { module->clearDisplay(); delay(100); } } switch (*mode) { case 0: module->setDisplayToString("press 1"); break; case 1: module->setDisplayToString("press 2"); break; case 2: module->setDisplayToString("press 3"); break; case 4: module->setDisplayToString("press 4"); break; case 8: module->setDisplayToString("press 5"); break; case 16: module->setDisplayToString("press 6"); break; case 32: module->setDisplayToString("press 7"); break; case 64: module->setDisplayToString("press 8"); break; case 128: module->setDisplayToString("press 9"); break; case 256: module->setDisplayToString("press 10"); break; case 512: module->setDisplayToString("press 11"); break; case 1024: module->setDisplayToString("press 12"); break; case 2048: module->setDisplayToString("press 13"); break; case 4096: module->setDisplayToString("press 14"); break; case 8192: module->setDisplayToString("press 15"); break; case 16384: module->setDisplayToString("press 16"); break; default: module->setDisplayToString("?????"); break; } } void loop() { update(&module, &mode); }
[/codesyntax]
Link
3 line 8 led keyboard display module mcu module tm1638 free shipping
Comments are closed.