Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Hexidraw_Demo Hexiwear-FinalProject_v2
Using the library
Initial Notes¶
You don't need to define any pins to use the library, the pins are already defined for you with the Hexiwear defaults.
The draw speed isn't very fast, so you can see the display drawing the graphics pixels by pixel, which either makes a cool effect (like expending circles) or looks sloppy.
How to use¶
Include the header file:
#include "hexidraw.h"
Create a new instance of the OLED class:
OLED oled;
And then setup the display, and turn it on:
oled.begin(); oled.wake(); oled.clear(WHITE);
You can also use sleep() to turn put the display into sleep mode (turns it off), and then just call wake() again to turn it back on.
Now you can call any of the functions such as rect(x, y, width, height, color), or circle (x, y, radius, color, width=1).
Using colors¶
You can use the function Color565(r,g,b) which was ported from the Adafruit GFX library to convert 0-255 colors into the 16-bit integers you need for passing to the OLED, e.g:
oled.circle(OLED_WIDTH/2, OLED_HEIGHT/2, 25, Color565(0,255,0));