Difference between revisions of "Matrix - 0.96' 128x64 OLED"
(→Compile Test Program) |
(→Compile & Run Test Program) |
||
Line 111: | Line 111: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | If your cloning is done successfully a "matrix" directory will be generated. | ||
− | + | Compile and install Matrix: | |
− | Compile | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | $ | + | $ cd matrix |
− | $ | + | $ make && make install |
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Run test program: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ matrix-oled | $ matrix-oled | ||
Line 142: | Line 129: | ||
"123456789" | "123456789" | ||
− | + | ==Code Sample== | |
<syntaxhighlight lang="c"> | <syntaxhighlight lang="c"> | ||
int main(int argc, char *argv[]) | int main(int argc, char *argv[]) |
Revision as of 14:51, 16 June 2016
Contents
1 Introduction
This is a tiny single color OLED. Its dimension is 0.96". Its resolution is 128 x 64. It can display text and graphics.It is high contrast and low power consumption. This module is powered by 5V which is then converted to 3.3V to OLED. It communicates via SPI or I2C. Its signal level is 3.3V. By default it communicates via SPI. If you want to set it to I2C you can change the module's resistor configuration.
2 Features
- Tiny
- High contrast, low power consumption
- SPI/I2C
- 2.54mm spacing pin header
- PCB Dimension(mm): 27 x 32
- Pin Description:
Pin | Description |
CS | Chip Selection |
DC | Data/Command |
RES | Reset |
MOSI | SPI MOSI |
CLK | SPI Clock |
5V | Power Supply 5V |
GND | Ground |
3 Basic Device Operation
4 Download Matrix Source Code
All the matrix modules' code samples are open source. They are maintained on GitHub --https://github.com/friendlyarm/matrix.git
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.
- The nanopi branch contains the matrix modules' code samples for the NanoPi
- The nanopi 2 branch contains the matrix modules' code samples for the NanoPi 2
- The tiny4412 branch contains the matrix modules' code samples for the Tiny4412
- The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi
Please follow the steps below to get the source code:
Install the git utility on a PC running Ubuntu14.04
$ sudo apt-get install git
Clone the matrix code from GitHub
$ git clone https://github.com/friendlyarm/matrix.git
If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.
5 Applications
5.1 Connect to NanoPi M1
Please refer to the following connection diagram to connect the module to the NanoPi M1
Matrix-0.96'_128x64_OLED_nanopi_m1
Connection Details
Matrix-0.96'_128x64_OLED | NanoPi M1 |
CS | Pin24 |
DC | Pin7 |
RES | Pin11 |
MOSI | Pin19 |
CLK | Pin23 |
5V | Pin2 |
GND | Pin6 |
5.2 Connect to NanoPi 2
Please refer to the following connection diagram to connect the module to the NanoPi 2:
Matrix-0.96'_128x64_OLED_nanopi_2
Connection Details:
Matrix-0.96'_128x64_OLED | NanoPi |
CS | Pin24 |
DC | Pin7 |
RES | Pin11 |
MOSI | SPI MOSI |
CLK | SPI Clock |
5V | Supply Voltage 5V |
GND | Ground |
6 Compile & Run Test Program
Boot your ARM board with Debian and copy the matrix code
$ apt-get update && apt-get install git $ git clone https://github.com/friendlyarm/matrix.git
If your cloning is done successfully a "matrix" directory will be generated.
Compile and install Matrix:
$ cd matrix $ make && make install
Run test program:
$ matrix-oled
Here is what you should expect:
matrix-oled_result
The OLED displays the following two lines:
"ABCDEFGHIJKLMN"
"123456789"
7 Code Sample
int main(int argc, char *argv[]) { int devFD; if ((devFD = OLEDInit(GPIO_PIN(7), GPIO_PIN(11))) == -1) { printf("Fail to init OLED\n"); return -1; } OLEDCleanScreen(devFD); // Char bitmap: 8x16 OLEDDisp8x16Str(devFD, 0, 0, "ABCDEFGHIJKLMN"); OLEDDisp8x16Str(devFD, 0, 16, "123456789"); OLEDDeInit(devFD); return 0; }
8 Connect to NanoPi
9 Connect to Tiny4412
10 Connect to RaspberryPi
11 Connect to Arduino
12 Resources
13 Update Log
13.1 Feb-19-2016
- Added Sections 3, 4, 5, 6 and 7