Home Code Arduino and Tm1638 button example

Arduino and Tm1638 button example

by shedboy71
[lebox id="1"]

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

[c]

#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);
}

[/c]

Share
[lebox id="2"]

You may also like