From b6913c28c8b1bb10d4fa18880495c927d161e05b Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Sat, 12 May 2018 20:36:51 +0300 Subject: [PATCH 1/2] New method to set brightness --- src/TM1638lite.cpp | 5 +++++ src/TM1638lite.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/TM1638lite.cpp b/src/TM1638lite.cpp index facc342..7f901b5 100644 --- a/src/TM1638lite.cpp +++ b/src/TM1638lite.cpp @@ -52,6 +52,11 @@ uint8_t TM1638lite::readButtons() return buttons; } +void TM1638lite::setBrightness(uint8_t value) +{ + sendCommand(0x88 | (value & 7)); +} + void TM1638lite::setLED(uint8_t position, uint8_t value) { pinMode(DATA_IO, OUTPUT); diff --git a/src/TM1638lite.h b/src/TM1638lite.h index f98b00f..cdb57ef 100644 --- a/src/TM1638lite.h +++ b/src/TM1638lite.h @@ -22,6 +22,7 @@ class TM1638lite void sendCommand(uint8_t value); void reset(); uint8_t readButtons(); + void setBrightness(uint8_t value); void setLED(uint8_t position, uint8_t value); void displayText(String text); void displaySS(uint8_t position, uint8_t value); From f5d21e69668a9462e2f76151e5588593e0aaef55 Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Sat, 12 May 2018 22:04:06 +0300 Subject: [PATCH 2/2] Example of the contrast usage --- examples/demo/demo.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/demo/demo.ino b/examples/demo/demo.ino index 80543ca..c52fc36 100644 --- a/examples/demo/demo.ino +++ b/examples/demo/demo.ino @@ -7,7 +7,7 @@ TM1638lite tm(4, 7, 8); void setup() { tm.reset(); - + tm.setBrightness(2); tm.displayText("Eh"); tm.setLED(0, 1);