Example
var oled = new OledDisplay();
var str = "OLED Display";
var strw = oled.stringWidth(str);
var strh = oled.stringHeight(str);
var strx = (oled.width() - strw) / 2;
var stry = (oled.height() / 2) + strh;
oled.clear();
oled.drawRect(0, 0, oled.width()-1, oled.height()-1);
oled.drawString(strx, stry, str);
API
OledDisplay(); // always connect to PORT_4E
startBuffer(); // subsequent draws will be buffered until flushBuffer() is called
flushBuffer(); // flush all buffered draws to screen
clear(); // clear screen
setColor(color); // COLOR_WHITE, COLOR_BLACK
setFont(font); // FONT_NORMAL, FONT_SMALL, FONT_LARGE, FONT_NORMAL_BOLD, FONT_SYMBOL
width(); // get width of screen (128)
height(); // get height of screen (64)
stringWidth(string); // get pixel width of string in current font
stringHeight(string); // get pixel height of string in current font
drawPixel(x, y);
drawLine(x1, y1, x2, y2);
drawRect(x1, y1, width, height, filled = false);
drawEllipse(x, y, rx, ry, filled = false);
drawString(x, y, string); // Note: y is baseline of text
Supported symbols
Note: supported symbols are Unicode characters and they can be directly entered into the RBX Web IDE through a Unicode-capable input method.
oled.drawString(10, 50, "⏰ ⏳ ✓");