Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "TM1637.h"
- #define CLK 3//pins definitions for the module and can be changed to other ports
- #define DIO 2
- #define button 10
- #define button2 11
- int number = 0;
- int bright = 0;
- TM1637 disp(CLK, DIO);
- void setup()
- {
- disp.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
- disp.init(D4056A);//D4056A is the type of the module
- pinMode(button, INPUT);
- pinMode(button2, INPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- if (!digitalRead(button))
- {
- number ++;
- disp.display(0, number);
- delay(200);
- }
- if (digitalRead(button2) == 0) {
- bright++;
- if(bright > 7)bright = 0;
- disp.set(bright);
- disp.display(0, number);
- delay(200);
- }
- // {
- // disp.clearDisplay()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement