Example i2c connection to raspberry pi 3A+

Hello to all

I need to connect an oled i2c display with 4 wires and can’t find a Xojo example. I have to write numbers on the display.
Can you help me please? This is the display I need to check.


Would this help,

New pigpio - GPIO wrapper for Raspberry Pi

BR Rainer

Thanks Rainer.
I am not an expert, I would need examples to then modify them for my case.
I’m not able to start from scratch.
However mixed dedicating to see if I understand anything

Hi most of the examples are in python or c for arduino.
Another option great cow basic or mblocks.

BR Rainer

example of i2c & raspberry & xojo :

lots of examples from einhugur :

Can I recommend you purchase this book by @Eugene_Dakin - highly recommended if you want to use Raspberry Pi with Xojo and various hardware components.



Thank you all.
the display works the connections are ok and the raspberry settings are ok.
if i run the phyton example it works.
I need to do it from xojo.
I’ve also seen examples of Einhugur, that’s not what I’m looking for on the display control.
I expect an example like this:

lcd.SetMessage (TextField1.Text, 1, true)



Did install / have a look Eugene Dakin pigpio-GPIO
And …
Did you setup Raspi correct ?

Do check ,
if everything you need is on py,
The pigpio library is installed by default on the Raspbian OS (May 2020) and instructions are available at http://abyz.me.uk/rpi/pigpio/download.html.

And : debug the python code,.
And check the lib and doc for this device…

Either online or if you have it already , see doc and maybe the sample code …
And if you want to do more with Xojo : spent the money for the book.
BTW : I have raspy and Arduino: for prototyping I use the raspy in a case with external keyboard and touchscreen, buildin breadboard and more…
Its not cheap>180 euro : but its worth it…

BR Rainer

Yes raspberry is set up and GPIO works, libraries installed and everything works with Python scripts.
I don’t know Phyton, I don’t know how to program it.
my program is in xojo, so I have to use xojo.

Hi, and that’s the point : raspi examples are in python … If you don’t want it: alternative is mblock,…
So Im happy to have the book.
BTW : with my raspy (4b) I bought more, but they talk python too…

BR Rainer

Hi Rainer.

Are there any Mblock examples that check the display on the book?


Hi Marco,
in the book is one chapter about I2C. And load the Xojo project on GitHub. Really a lot of work done, for sending some bytes…

But without the doc for the display its not easy. BTW python does the same as Xojo, but somebody has done the work for you.

BTW : see also : http://gcbasic.sourceforge.net/Typesetter/index.php/Home ( if you don’t like python … thx Markus )
And question : as Xojo can do nice GUI or Web on Raspis, why I2C Displays. …
BR Rainer

HI Rainer.
I am building a mini portable profilometer for my work, a very simple thing a blue laser line, a camera, the battery pack and the raspberry pi 3A +.
The software to measure that I made with xojo is ready, only the mini display is missing to show the measures.
that’s why i want to use xojo.

But if you have understood the gpio lib it should be easy to drive the display…

BTW : from Raspi spec: * DSI display port for connecting a Raspberry Pi touchscreen display

BR Rainer

Hy Rainer
that’s the problem.
I haven’t figured it out yet and was looking for working examples.
But apparently for oled displays with i2c there are none, except in phyton.

Hi Marco,
if have started this year with Pi and Arduino… Before I had Cubietrucks …
Cool thing this raspi…

And I have purchased some books (German) from Franzis
… /maker/smart-home-hausautomation/e-book-paket-maker-projekte-bundle
And Im happy now, there is a book to use Raspi with XOJO.


Found : Adafruit 128x32 PiOLED (adafruit.com/product/3527 ) … and its cheap…
and there is documentation : Overview | Adafruit PiOLED - 128x32 Mini OLED for Raspberry Pi | Adafruit Learning System
[Usage | Adafruit PiOLED - 128x32 Mini OLED for Raspberry Pi | Adafruit Learning System](… learn.adafruit.com/adafruit-pioled-128x32-mini-oled-for-raspberry-pi/usage)

Ok its Python again … they are also sending some bytes (maybe the same as with the gpio lib for Xojo



Hope this will bring some light into dark… its a init / open… send data/ close / rest is in data sheet / BR Rainer

Hello Marco,

The program may need to have the lcd library converted to Xojo, as there are many different types of lcd’s and code to drive each lcd. Maybe check the library and ensure the I2C handshake and driver code for the I2C data is correct.

Warm regards.