I've made a library for the Nokia 3310 display

Hi. I just picked up some Nokia 3310 displays off ebay, just 3.5USD a piece, 48x84 pixels with backlight. I'm going to use these displays for a lot of projects from now on as I find them superior to any 7-seg, dot-matrix or numerical LCD display. One thing I didn't find was a library for it so I decided to make one myself. This is the first library I've made so I don't know all the conventions to use etc, but it works just fine if anyone is interested. It writes small 4-digit integers, small characters, big 4-digit integers and big characters as well as having the option to invert text and write directly to the [6][84] data array for custom control. Giving that these displays are so cheap, handy and easy to use I find it odd that I couldn't find a library for it. Have I just not searched for long enough or might there be an interest in the library that I've made?

keywords.txt (185 Bytes)

Nokia.cpp (26.9 KB)

Nokia.h (790 Bytes)

Nokia 3310 is 5110, right ?

You only had to use Google.
http://playground.arduino.cc/Code/PCD8544

The U8Glib supports it of course.
https://code.google.com/p/u8glib/
Search for pcd8544 on this page:
https://code.google.com/p/u8glib/wiki/device
The U8Glib makes it easy to replace it with a OLED display, since those are also supported by the U8Glib.

I have somewhere a Arduino Uno connected to an Nokia 5110, but I did not try your code. Looking at your code, it is very consistent. I like seeing code like that, although I would use more type casting, even when it is not necessary.

You could also cut down on some memory if you change your variable types. I noticed you are using ints in the FOR loops that don't exceed 255, so you can use (byte or unsigned char) and if you need something to start from -1 or go into the negative range and not exceed -127 to 128, then you can use char.

Every little bit of memory you can save, makes a big difference in the long run. Especially if you have large sketches.

Just something to keep in mind, overall good job. :sunglasses: