Using OLED module (SH1106 / SSD1306... etc.)
Last updated
Last updated
Other than the Grove OLED, you might use other OLEDs which are with different controllers. Based on the work of olikraus, we ported the original U8g_Arduino library to LinkIt 7697 BSP. You can download and use it to drive different types of OLEDs with LinkIt 7967. For details, you can check the compete list of supported OLEDs in the official WiKi. For how to install the driver, you can also refer to another tutorial for installing it. Here we give a brief example to show how to use it and a commonly-seen issue.
We use a 4-pin 128x64 I2C OLED module as the example. Connect the 3V3 / GND / P8 / P9 pins on LinkIt 7697 to VCC / GND / SCL / SDA pins on the OLED module, respectively. After installing the driver, open the example under File / Examples / U8g2 / page_buffer / GraphicsTest sub-menu in the Arduino IDE. Follow the initialization process in the Software Setup section below, compile and upload this sketch to LinkIt 7697, you should be able to see different patterns displaying on the OLED module.
After opening the GraphicsTest example sketch, you'll see lots of constructors commented out in the beginning of the file. Uncomment one of them according to the part number (and the interface, e.g. HW I2C or SPI) of the driving IC on your OLED module. For example, the driving IC on our testing set is SH1106 with HW I2C, so we uncommented Line 71 to instantiate the module correctly:
Then compile and upload the sketch file to LinkIt 7697. You'll see different patterns showing on the OLED module.
Note
There are some 128x64 OLED modules marked with the SSD1306 driving IC but in fact they are NOT. If you used the SSD1306 constructor to drive an OLED module and saw patterns offsetting by some pixels (the left side are cut and the right side shows uninitialized columns) like below, this indicates it's not a SSD1306 OLED module. In our case, it's a SH1106 instead (Reference).