OLED 1602 Display and library for the SSD1311
Following on from the last post, the OLED 2 line 16 character display arrived from Hong Kong.
The display uses I2C to connect to the host and will work at 3.3 or 5V so is ideal to use with an Arduino board.
The supplier WIDE.HK supplies some sample code to get it running in the form of a QR code on the packaging that links to the the code and a couple of PDF datasheets.
The code uses a long winded method to initialise and write to the display, but it gets it working.
I have been thinking it was about time I learned how to create a library and this gave me the reason to give it a go, as well as not being able to find a library for this device anywhere on the web.
The very basic Library can be downloaded here, please remember this is my first attempt at creating a library, it works but I imagine it needs more functions adding before it becomes very useful.
Library updated 7/11/13 see here.
Here is the demo code I wrote using the library: -
Demo sketch to display text on the OLED 1602 display
from Wide.HK. This uses a Lbrary that I've put together
containing some basic functions.
The I2C Address is set to 0x3C in OLedI2C.cpp
Phil Grant 2013 www.gadjet.co.uk
Sketch updated to work with new library 7/11/13
//Set cursor position to col and row, top row is 0, first col is 0
// no longer required LCD.cursPos(4,0); //(col,row)
LCD.sendString("Gadjet's", 4, 0); //("String", col, row)
// no longer required LCD.cursPos(6,1); //Set cursor position to col and row
LCD.sendString("BLOG", 6, 1); //("String", col, row)
As usual, feedback welcomed, use the comments if you found this library useful ...... or not.