Reference
This article serves as a comprehensive reference guide for utilizing the Gravity-I2C 8x16 RGB LED Matrix Panel, covering API descriptions for printing strings and numbers, displaying images, scrolling text, and more with practical Arduino examples.
Built-in Images

Colors

API Description
Print String
Prototype:void print(String ,unsigned char color)
- Function: Print a string in the panel.
- Parameters:
- String: string, with “ ” enclosed
- Color: color to show
- Red: RED
- Green: GREEN
- Yellow: YELLOW
- Blue: BLUE
- Purple: PURPLE
- Cyan: CYAN
- White: WHITE
E.g.
#include<Wire.h>
#include <DFRobot_RGBPanel.h>
DFRobot_RGBPanel panel;
void setup() {
}
void loop() {
panel.print("DF1", BLUE); //Display DF1 in BLUE
}
Print Numbers and Variables
Prototype:void print(int val,unsigned char color)
- Function: Print Numbers and Variables in the plane.
- Parameters:
- Val: int values or int variables
- Color: color to show
- Red: RED
- Green: GREEN
- Yellow: YELLOW
- Blue: BLUE
- Purple: PURPLE
- Cyan: CYAN
- White: WHITE
E.g.
#include<Wire.h>
#include <DFRobot_RGBPanel.h>
DFRobot_RGBPanel panel;
void setup() {
}
void loop() {
int a=12;
panel.scroll(Left);
panel.print(a, BLUE); //Print variable a in BLUE.
while(1);
}
Scroll Display
Prototype:void scroll(unsigned char dir)
- Function: Scroll Display
- Parameters:
- Scroll in left: Left
- Scroll in right: Right
- Stop scroll: None
E.g.
#include<Wire.h>
#include <DFRobot_RGBPanel.h>
DFRobot_RGBPanel panel;
void setup() {
}
void loop() {
panel.scroll(Left); //Set to scroll in left
panel.print("DFRobot", BLUE); //Show "DFRobot" in BLUE
while(1);
}
Display Pixels
Prototype:void pixel(unsigned char x,unsigned char y,unsigned char color)
- Function: Spicify a pixel to show
- Parameters:
- x:pixel position in x direction(value:0~7)
- y:pixel position in y direction(value:0~15)
- Color: color to show
- Red: RED
- Green: GREEN
- Yellow: YELLOW
- Blue: BLUE
- Purple: PURPLE
- Cyan: CYAN
- White: WHITE
E.g.
#include<Wire.h>
#include <DFRobot_RGBPanel.h>
DFRobot_RGBPanel panel;
void setup(){
Serial.begin(9600);
}
// Set the 1st LED to off, other 7 LEDs show GREEN, YELLOW, BLUE, PURPLE, CYAN, WHITE respectively.
void loop(){
panel.pixel(0,0,QUENCH);
panel.pixel(0,1,RED);
panel.pixel(0,2,GREEN);
panel.pixel(0,3,YELLOW);
panel.pixel(0,4,BLUE);
panel.pixel(0,5,PURPLE);
panel.pixel(0,6,CYAN);
panel.pixel(0,7,WHITE);
}
Clear Display
Prototype:void clear();
- Function: Clear the display.
- Parameters: None
E.g.
#include<Wire.h>
#include <DFRobot_RGBPanel.h>
DFRobot_RGBPanel panel;
void setup(){
}
//Show"DF1"in the panel and flash in every second.
void loop(){
panel.print("DF1", BLUE);
delay(1000);
panel.clear();
delay(1000);
}
Show All
Prototype:void fillScreen(unsigned char color)
- Function:
- Parameters:
- Color: color to show
- Red: RED
- Green: GREEN
- Yellow: YELLOW
- Blue: BLUE
- Purple: PURPLE
- Cyan: CYAN
- White: WHITE
- Color: color to show
E.g.
#include<Wire.h>
#include <DFRobot_RGBPanel.h>
DFRobot_RGBPanel panel;
void setup(){
}
//Fill in the display panel in BLUE and flash in every second.
void loop(){
panel.fillScreen(BLUE);
delay(1000);
panel.clear();
delay(1000);
}
Show Built-in Images

Prototype:void display(unsigned char picIndex,unsigned char color)
- Function: show built-in 23 images in the display panel, number as 0~22.
- Parameters:
- Color: color to show
- Red: RED
- Green: GREEN
- Yellow: YELLOW
- Blue: BLUE
- Purple: PURPLE
- Cyan: CYAN
- White: WHITE
- Color: color to show
E.g.
#include<Wire.h>
#include <DFRobot_RGBPanel.h>
DFRobot_RGBPanel panel;
void setup(){
Serial.begin(9600);
}
//Show No.3 image in RED and flash in every second.
void loop(){
panel.display(3,RED);
delay(1000);
panel.clear();
delay(1000);
}
Was this article helpful?
