To get this display working on the Arduino, first we will need to install a couple of Arduino libraries.
Install Arduino Libraries
Lets begin by installing all the libraries we need. Open up the library manager in Arduino IDE
Search for and install the Following libraries:
Adafruit GFX
If using an earlier version of the Arduino IDE (pre-1.8.10), locate and install Adafruit_BusIO (newer versions handle this prerequisite automatically).
Adafruit RA8875
Once you have installed these, restart the Arduino IDE
Start by connecting the power pins
- 3-5V Vin connects to the Arduino 5V pin
- GND connects to Arduino ground
- SCK connects to SPI clock. On Arduino Uno/Duemilanove/328-based, thats Digital 13. On Mega's, its Digital 52 and on Leonardo/Due/Metro M0/M4 it's ICSP-3 (See SPI Connections for more details)
- MISO connects to SPI MISO. On Arduino Uno/Duemilanove/328-based, thats Digital 12. On Mega's, its Digital 50 and on Leonardo/Due/Metro M0/M4 it's ICSP-1 (See SPI Connections for more details)
- MOSI connects to SPI MOSI. On Arduino Uno/Duemilanove/328-based, thats Digital 11. On Mega's, its Digital 51 and on Leonardo/Due/Metro M0/M4 it's ICSP-4 (See SPI Connections for more details)
- CS connects to our SPI Chip Select pin. We'll be using Digital 10 but you can later change this to any pin
- RST connects to our Reset pin. We'll be using Digital 9 but you can later change this pin as well.
- INT connects to our Interrupt pin. We'll be using Digital 3 but you can later change this pin too.
That's it! You don't need to connect any of the other pins.
Be sure to set the screen size in the sketch to the appropriate size and upload it to your Arduino
You'll see a graphics test program run, showing drawing lines, text, rectangles, ellipses, triangles, etc.
Feel free to touch the screen if your LCD Display is a touchscreen. The screen will start drawing dots where your finger was.
Text Mode
Unlike many displays, the RA8875 requires switching modes between drawing text and graphics. They can still be drawn on the screen at the same time, but you are required to manually set the appropriate mode for the type of function you wish to call.
Start by opening up the file -> examples -> Adafruit RA8875 -> textmode
Just like the previous example, be sure to set the screen size in the sketch to the appropriate size and upload it to your Arduino
You'll see a text mode test print out "Hello, World!" in a variety of colors and sizes.