Library for interfacing to Nokia 5110 LCD display (as found on the SparkFun website).

Dependents:   LV7_LCDtest LV7_Grupa5_Tim003_Zadatak1 lv7_Grupa5_Tim008_zad1 LV7_PAI_Grupa5_tim10_Zadatak1 ... more

This library is designed to make it easy to interface an mbed with a Nokia 5110 LCD display.

These can be found at Sparkfun (https://www.sparkfun.com/products/10168) and Adafruit (http://www.adafruit.com/product/338).

The library uses the SPI peripheral on the mbed which means it is much faster sending data to the display than other libraries available on other platforms that use software SPI.

The library can print strings as well as controlling individual pixels, meaning that both text and primitive graphics can be displayed.

Revision:
10:6f3abb40202b
Parent:
8:40abe5736eca
Child:
11:fc7d89b33e4c
--- a/N5110.h	Tue May 20 19:43:52 2014 +0000
+++ b/N5110.h	Wed Jul 16 08:42:27 2014 +0000
@@ -66,7 +66,27 @@
   lcd.setXYAddress(0,3);
   // print character
   lcd.printChar('X');
-    
+  
+  // data to be printed on display
+  int temperature = 27; 
+  // print formatted data to buffer
+  char buffer[14];  // each character is 6 pixels, screen is 84 pixels (84/6 = 14) 
+  int length = sprintf(buffer,"Temperatu = %2d",temperature); 
+  // it is important the format specifier ensures the string will fit in the buffer
+  // if string will fit on display
+  if (length <= 14)  
+    lcd.printString(buffer,0,4);       // display on screen
+  else
+    lcd.printString("Too long",0,4);  // else print error message
+
+  // same idea with floats
+  float humidity = 9.45;  
+  length = sprintf(buffer,"Humidit = %4.2f",humidity);
+  if (length <= 14)
+    lcd.printString(buffer,0,2);
+  else
+    lcd.printString("Too long",0,2);
+        
   while(1);
  }