SSD1327 OLED driver
Support is included in the SSD1327 (About Modules) module, using the Graphics library.
This module allows you to drive a SSD1327 powered OLED display using I2C. This module only has been tested on an ESP8266 (4MB) flashed with Espruino. There is currently no SPI support.
I2C
Just wire up as follows:
OLED pin | Example pin on Espruino Board |
---|---|
GND | GND |
VCC | 3.3V / 5V |
SDA | B7 |
SCL | B6 |
Software
function start(){
// set contrast
g.setContrast(128);
// set gray tint (0 is black, 15 is white)
g.setColor(15);
// write some text
g.drawString("Hello World!",2,2);
// write to the screen
g.flip();
}
// I2C
I2C1.setup({scl:D5,sda:D4,bitrate:400000});
var g = require("SSD1327").connect(I2C1, start, { address: 0x3C, height: 128 });
Note: This module uses a double buffer, which means you need to call g.flip()
before any changes take effect.
128x32 or 128x64
By default the module is configured for 128x128 OLEDs. If you want to use 128x32 or 128x64 OLEDs, you must specify the height in the optional height argument. This has not yet been tested.
// I2C
require("SSD1327").connect(I2C1, start, { height : 64 });
Non-standard I2C addresses
If your I2C module uses another I2C address than the standard 0x3C it can be explicitly specified using the optional address argument like so:
require("SSD1327").connect(I2C1, start, { address : 0x3D });
Contrast
You can set the contrast after initialisation using g.setContrast(31)
with a value between 0 and 255.
On/Off
The screen can be turned off using g.on()
or g.off()
.
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.