Categories

Arduino and Tm1638 button example

This code snippet will get the button value and display the value on the 7 Segment LED and the LEDs

TM1638 Chip Key Display Module

TM1638 Chip Key Display Module

Code


#include <TM1638.h>
// define a module on data pin 8, clock pin 9 and strobe pin 10
TM1638 module(8, 9, 10);

byte buttons;
void setup()
{
}

void loop()
{
//get the button
//S1 = 1, S2 = 2, S3 = 4, S4 = 8
//S5 = 16, S6 = 32, S7 = 64, S8 = 128
buttons=module.getButtons();
module.setDisplayToDecNumber(buttons,0,false);
module.setLEDs(buttons);
}

Share

Comments are closed.