Dieses Blog durchsuchen

Seiten

Labels

Raspberry (8) RPI (8)

Freitag, 15. Juni 2018

How to connect a OLed (I2c) to Raspberry and programing with mono (c#)

 

This little blog shows you how to connect a 0.96" OLed to the Raspberry and programming with C#.

First of all we need the right OLed with the I2C interface, in my case i used a 0,96 Inch Oled for ~3€ in Ebay like this. It is controlled by a SSD1306 controller the hardware documentation can be found here: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf



Now we connect the OLed to the Raspberry as follow:


The hardware is ready but now we need the code and libraries now. In my case i use the WiringPi library in combination with Mono. I love mono and it work's pretty well with my Rasperry zero W.

Install Mono and WiringPi

see this links to install WiringPi and Mono
http://wiringpi.com/download-and-install/
https://www.mono-project.com/download/stable/#download-lin-raspbian 

 After installed, check the follow:

Mono


WiringPi



Setup I2C on the Raspberry


Enable I2C run:  sudo raspi-config









Now close and reboot
After this the I2C module is available, please chek it with lsmod:




The code


My C# code is a small example and paints a rectangle and elipse on the 0.96 Inch Display with 128x64 Pixel. I use WiringPi function as an DllImport to communicate
You can download or clone the Visual Studio 2017 Project from here:
https://github.com/maza70/Oled_SSD1306








Keine Kommentare:

Kommentar veröffentlichen