Library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website).
Fork of N5110 by
Diff: N5110.cpp
- Revision:
- 44:cd9bc22f656d
- Parent:
- 43:c2598020fcac
diff -r c2598020fcac -r cd9bc22f656d N5110.cpp --- a/N5110.cpp Tue Mar 21 11:46:14 2017 +0000 +++ b/N5110.cpp Wed May 03 12:52:37 2017 +0000 @@ -75,6 +75,10 @@ clearRAM(); // RAM is undefined at power-up so clear clear(); // clear buffer setBrightness(0.5); + + // Initialising the frame count variable to 0 + _frameCount = 0; + _textTransparency = 0; } // sets normal video mode (black on white) @@ -132,6 +136,13 @@ _led->write(brightness); } +// function to get led brightness +float N5110::getBrightness() +{ + // Returns value between 0.0 and 1.0; + return _led->read(); +} + // pulse the active low reset line void N5110::reset() @@ -302,6 +313,24 @@ } } +void N5110::printFlashingString(const char *str, + unsigned int const x, + unsigned int const y, + unsigned int const framesBeforeUpdate) +{ + if (++_frameCount == framesBeforeUpdate) + { + _frameCount = 0; + _textTransparency = !_textTransparency; + + } + + if (!_textTransparency) + { + this->printString(str, x, y); + } +} + // function to clear the screen buffer void N5110::clear() {