A basic LCD output test which uses the NXP LPC1768\'s SPI interface to display pixels, characters, and numbers on the Nokia 5110 or Nokia 3310 LCD.
Fork of Nokia5110 by
Revision 4:f2e807b8fecc, committed 2014-12-23
- Comitter:
- gonzo1964
- Date:
- Tue Dec 23 22:17:07 2014 +0000
- Parent:
- 3:41063eb2a040
- Commit message:
- zbyszekgonda1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Jan 10 22:22:17 2014 +0000 +++ b/main.cpp Tue Dec 23 22:17:07 2014 +0000 @@ -2,39 +2,70 @@ // File: main.cpp // Author: Chris Yan // Created: January, 2012 -// Revised: -// Desc: A basic LCD output test which uses the NXP LPC1768's SPI interface to +// Revised: +// Desc: A basic LCD output test which uses the NXP LPC1768's SPI interface to // display pixels, characters, and numbers on the Nokia 5110 LCD. // Created using a sparkfun breakout board with integrated Phillips 8544 driver // for 48x84 LCDs. #include "mbed.h" #include "NOKIA_5110.h" - +DigitalIn mybutton(USER_BUTTON); +DigitalOut myled(LED1); +int i; +int litera(70); int main() { // Init the data structures and NokiaLcd class LcdPins myPins; - myPins.sce = p8; - myPins.rst = p9; - myPins.dc = p10; - myPins.mosi = p11; + myPins.sce = D8; + myPins.rst = D9; + myPins.dc = D10; + myPins.mosi = D11; myPins.miso = NC; - myPins.sclk = p13; - + myPins.sclk = D13; + NokiaLcd myLcd( myPins ); - + // Start the LCD myLcd.InitLcd(); - - // Draw a test pattern on the LCD and stall for 15 seconds - myLcd.TestLcd( 0xAA ); - wait( 15 ); + // Test the LCD + myLcd.TestLcd( 0xff ); + wait( 0.1 ); +myLcd.ClearLcdMem(); + - // Turn off the LCD and enter an endless loop - myLcd.ShutdownLcd(); - while( 1 ) - { - //dance + +/* +myLcd.SetXY(1,1); +myLcd.DrawString("POL"); +myLcd.SetXY(2,2); +myLcd.DrawString("POL"); +*/ + + +myLcd.SetXY(1,1); +myLcd.DrawChar(70); +myLcd.SetXY(12,2); +myLcd.DrawChar(71); +myLcd.SetXY(11,13); +myLcd.DrawChar(72); +myLcd.SetXY(212,222); +myLcd.DrawChar(73); + + + + while( 1 ) { + /* + for (i=1; i<197; i++) { + myLcd.DrawChar( litera); + wait(0.1); //dance + if (mybutton == 0) { // Button is pressed + myled = !myled; // Toggle the LED state + litera++; + wait(0.2); // 200 ms + }} + */ + } } \ No newline at end of file
--- a/mbed.bld Fri Jan 10 22:22:17 2014 +0000 +++ b/mbed.bld Tue Dec 23 22:17:07 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/5364839841bd \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file