diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2014-10-29 23:34:44 +1100 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2014-10-29 23:34:44 +1100 |
commit | 23b4f328664805b053ab3ab451b8392a03a02f94 (patch) | |
tree | ec8958e774206f8b2be528ea2eaf1d46a750e9a1 /megalogger | |
parent | e7843dae1650cfaa31c39b4ba73aee8fa78f6fb5 (diff) | |
download | 2021-arduino-obd-23b4f328664805b053ab3ab451b8392a03a02f94.tar.gz 2021-arduino-obd-23b4f328664805b053ab3ab451b8392a03a02f94.tar.bz2 2021-arduino-obd-23b4f328664805b053ab3ab451b8392a03a02f94.zip |
add backlight fade in/out effect
Diffstat (limited to 'megalogger')
-rw-r--r-- | megalogger/megalogger.ino | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/megalogger/megalogger.ino b/megalogger/megalogger.ino index 3ea1a72..b536e62 100644 --- a/megalogger/megalogger.ino +++ b/megalogger/megalogger.ino @@ -468,7 +468,11 @@ private: //digitalWrite(SD_CS_PIN, LOW); for (uint16_t i = 0; ; i++) { if (i == 3) { - lcd.backlight(false); + // fade out backlight + for (int n = 254; n >= 0; n--) { + lcd.setBackLight(n); + delay(20); + } lcd.clear(); } if ((getState() != OBD_CONNECTED || errors > 1) && !init()) @@ -480,7 +484,6 @@ private: Narcoleptic.delay(2000); } - lcd.backlight(true); // re-initialize state |= STATE_OBD_READY; startTime = millis(); @@ -490,6 +493,11 @@ private: openFile(); #endif initScreen(); + // fade in backlight + for (int n = 1; n <= 255; n++) { + lcd.setBackLight(n); + delay(10); + } } byte state; @@ -665,11 +673,15 @@ void setup() { lcd.begin(); lcd.setFontSize(FONT_SIZE_MEDIUM); - lcd.backlight(true); lcd.setColor(0xFFE0); lcd.print("MEGA LOGGER - OBD-II/GPS/G-FORCE"); lcd.setColor(RGB16_WHITE); + for (int n = 0; n <= 255; n++) { + lcd.setBackLight(n); + delay(10); + } + #if USE_GPS #ifdef GPS_OPEN_BAUDRATE GPSUART.begin(GPS_OPEN_BAUDRATE); |