RL78 G23 64p FPB SSD1309 (Arduino™ Sketch) - renesas/Arduino GitHub Wiki
Introduction
- This page describes how to operate a sample that displays strings on OLED using SSD1309 as an example.
- For basic information such as how to install the Arduino IDE and Arduino libraries, and how to write sketches to the board, see Quick Start Guide.
Environments and products
- This page uses the following environments and products for explanations.
- Arduino IDE 2.3.2
- Arduino Library v2.3.1
- U8g2 2.34.22
- RL78/G23-64p Fast Prototyping Board
- SSD1309 (Operating voltage: 5V)
- If you use SSD1309 with an operating voltage of 3.3V, you need to change the drive voltage.
- Please see below for instructions on how to change the drive voltage.
How to drive the board's port output to 3.3V.
Install U8g2
- Start Arduino IDE and select the library icon
- Enter "U8g2" in the library manager form, search for it, and press the "Install" button
- The "U8g2" library will be downloaded and installed in the Arduino IDE
Write a sketch
- Select「File」→「Examples」→「U8g2」→「full_buffer」→「HelloWorld」
- Change the sketch below
- Line 159 "//U8G2_SSD1309_128X64_NONAME0_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=/ 13, / data=/ 11, / cs=/ 10, / dc=/ 9, / reset=*/ 8 );” delete the "//" part at the beginning to remove the comment
- Line 371 change "Hello World!" in "u8g2.drawStr(0,10,"Hello World!");" to "RL78/G23 and SSD1309"
- Write "u8g2.drawStr(0,20,"RENESAS!");" next line
Pin connection
- Connect the pins of RL78/G23-64p FPB and SSD1309 as shown below
- If you are using an SSD1309 with an operating voltage of 3.3V, connect VCC to the 3V3 pin of the FPB.
■SSD1309 and RL78/G23-64p FPB pin correspondence table
SSD1309 pin | RL78/G23-64p FPB pin |
---|---|
CS | 10 |
DC | 9 |
RES | 8 |
SDA | 11 |
SCL | 13 |
VCC | 5V |
GND | GND |
■Connection diagram of SSD1309 and RL78/G23-64p FPB
Compile, upload and string display
- Compile and upload
- Select "Upload" in the Arduino IDE will start compile and upload
- An OLED string will be displayed as shown below