Javadoc link

OledSsd1306 is a service that makes it possible to use a small OLED display.  

For example this https://www.adafruit.com/products/938. You can find many other displays that use the ssd1306 chip and most of them should be possible to use with MNRL. However, currently only the i2c protocol is implemented in MRL, so it's possible that you have one wired for SPI, In that case you need to rewire it to use i2c. 

This is one guilde that I found on how to do that: http://electronics.stackexchange.com/questions/164680/ssd1306-display-i…

Some of the OLED displays are only wired for 3v3. In that case you may have to use an i2c level shifter, since the Arduino uses 5V.

For the electrical connections refer to the Arduino and the OLED's pins. For i2c you need 4 wires, VCC, GND, SCL ( clock ) and SDA ( data ).

Currently only limited functions are implemented in OledSsd1306 but that may change in the future. 

What you can do is th create a bitmap image and convert it to an array that will be displayed on the OLED.

Images arrays are created using the LCDAssistance as described here:

 
You can downloaded the LCDAssistance from here:

 

 

Example code (from branch develop):
# config 
port = "COM3"
# Code to be able to use this script with virtalArduino
if ('virtual' in globals() and virtual):
    virtualArduino = runtime.start("virtualArduino", "VirtualArduino")
    virtualArduino.connect(port)
#
# Initiate the Arduino
arduino = runtime.start("Arduino","Arduino")
arduino.connect(port)
# Alternativley you can use the RasPi service to connect the OLED to the GPIO pins
# raspi = runtime.start("RasPi","RasPi")
# Select the Arduino as controller for the OLED on bus 1 and i2c address 0x3C
oled = runtime.start("OLED","OledSsd1306")
# From version 1.0.2316 use attach instead of setController
# oled.setController(arduino,"1","0x3C")
oled.attach(arduino,"1","0x3C")
# Alternative if you use the RasPi
# oled.attach(raspi,"1","0x3C")
# Demo to show how to write images
# Images arrays are created using the LCDAssistance as described here:
# https://learn.adafruit.com/monochrome-oled-breakouts/arduino-library-and-examples
# and downloaded from here:
# http://en.radzio.dxp.pl/bitmap_converter/
# 
"Now upgraded so that",0,0,1)
oled.drawString("you also can display",0,8,1)
oled.drawString("text very easy",0,16,1)
oled.drawString("MyRobotLab",28,46,1)
oled.display()
sleep(1)
oled.fillDisplay()
oled.drawStringCentered("MyRobotLab",16,0)
oled.display()
sleep(2)
def drawSadEyes(): 
  oled.clearDisplay()
  oled.drawBitmap(42, 0,   logo16_solid_glcd_bmp, 16, 16, 1)
  oled.drawBitmap(42, 20,  logo16_solid_glcd_bmp, 16, 16, 1)
  oled.drawBitmap(62, 20,  logo16_solid_glcd_bmp, 16, 16, 1)
  oled.drawBitmap(82, 20,  logo16_solid_glcd_bmp, 16, 16, 1)
  oled.drawBitmap(42, 40,  logo16_solid_glcd_bmp, 16, 16, 1)
  oled.drawBitmap(62, 40,  logo16_solid_glcd_bmp, 16, 16, 1)
  oled.drawBitmap(82, 40,  logo16_solid_glcd_bmp, 16, 16, 1)
  oled.display()
drawSadEyes()

kyle.clinton

7 years 5 months ago

I was able to add the address for my second display in Junior's head and get them both working.  I now have to work on making my original eye displays.  I can't have people saying my robot has Mats' eyes... This is awesome work! So great to have this community to solve these problems with.

Example configuration (from branch develop):
!!org.myrobotlab.service.config.ServiceConfig
listeners: null
peers: null
type: OledSsd1306