B4R Library rAdafruitSSD1306 - OLED displays

This is a wrapper for this open source project: https://github.com/adafruit/Adafruit_SSD1306

It depends on rAdafruitGFX library: https://www.b4x.com/android/forum/threads/radafruitgfx.68904/

It allows drawing graphics and text on supported monochrome OLED modules.

I've tested it with an I2C module. You need to pass the I2C address (default is 0x3c) and an available pin (4) in the example.

The GFX field from the SSD object is used for the drawings.
B4X:
ssd.GFX.DrawCircle(px, py, radius, ssd.BLACK, True)
The drawings will only appear on the module after you call ssd.Display.

There are two examples attached.
The first is a bouncing ball:


The second one, which runs on ESP8266, implements a clock:

SS-2016-07-12_15.41.19.jpg
 

Attachments

  • BouncingBall.zip
    851 bytes · Views: 1,057
  • Clock.zip
    1.8 KB · Views: 1,206
  • rAdafruitSSD1306.zip
    33.4 KB · Views: 1,131
Last edited:

monki

Active Member
Licensed User
Longtime User
I have update my project with the new library, srolling works perfect
many thanks
monki
 

kolbe

Active Member
Licensed User
Longtime User
I've updated the library and it now supports scrolling. There was a typo in the previous version. The type name was AdafruitSSD1305 instead of AdafruitSSD1306. This was fixed.

You will need to update your existing projects.

Would you care to update these libraries again to support the ESP32. I tried swapping the newer libraries with this wrapper but I got a variety of errors I didn't know how to fix.
 

JMB

Active Member
Licensed User
Longtime User
Hi there,

I am trying to use this code to run on d-duino board with a built in display but without success.

When I program it from Arduino I have no problems with this code:
B4X:
// Initialize the OLED display using Wire library
 SSD1306Wire  display(0x3c, D1, D2);

How does one specify the correct pins for the I2C bus in the provided code?

Thanks.

JMB
 

JMB

Active Member
Licensed User
Longtime User
Hmm. No. Those examples do not work with this board. It would appear that it uses a different include file so the AdaFruit wrapper doesn't work.
 

Peter Simpson

Expert
Licensed User
Longtime User
Top