1.5inch OLED Module User Manual
1. WiringPi oprates by read/write the device files of Linux OS. and the bcm2835 is library
function of Raspberry Pi’s CPU, it operates registers directly. Thus, if you have used
bcm2835 libraries firstly, the usage of WiringPi code will be failed. In this case, you just
need to reboot the system and try again.
2. Due to the first difference, they underlying configuration are different. In DEV_Config.c,
use wiringpiPi and the corresponding wiringPiSPI to provide underlay interfaces.
User command sudo ./oled_1in5 to run the code.
4.3 Python
Execute command ls:
DEV.Config.py: Hardware pin defined here, change USE_SPI_4W and USE_I2C to switch the
communication mode.
OLED.Driver.py: Drive code of OLED
main.py: main function, use Image libraries.
Run codes: sudo python main.py
Note: Some of Raspbian has no image libraries, in this case, you can run this command to install
it: sudo apt-get install python-imaging
Image is an image handle library of python, it uses an image object to express an image.
Use new to create a blank image, set the size as resolution of OLED, and calling Draw libraries to
paint it, finally transmit the image data to OLED to display.
Image.new("L", (OLED.OLED_Dis_Column, OLED.OLED_Dis_Page), 0); “L” is grayscale.
For python, you can use open function to open an image instead of converting to arrays.
Please set the image to 16-bit grayscale and make sure the size of image doesn’t larger than the
resolution.
4.4 Auto-run after booting.
Initialize auto run in Raspberry Pi by configuring code of /etc/rc.local file:
sudo vim /etc/rc.local
Before exit0 add:
sudo python /home/pi/python/demo.py &
Important: to place the program /home/pi/python/demo.py at the same director, you can input
command pwd to get the path. And & character is necessary at the end of command line,