Example Code of Drawing a Circle for Arduino
Last revision 2026/02/04
The article provides an example code to draw a circle with a center point at (0,0), radius 20, green arc, and red fill using Arduino and the DFRobot_ST7687S_Latch library.
Introduction
The function of the program: draw a circle with a center point coordinate (0,0), radius 20 and green arc at the centre of the screen, and fill the circle with red.
Sample Code
#include "DFRobot_ST7687S_Latch.h"
#ifdef __AVR__
uint8_t pin_cs = 3, pin_rs = 5, pin_wr = 6, pin_lck = 7;
#else
uint8_t pin_cs = D3, pin_rs = D5, pin_wr = D6, pin_lck = D7;
#endif
DFRobot_ST7687S_Latch tft(pin_cs, pin_rs, pin_wr, pin_lck);
void setup(void)
{
Serial.begin(115200);
tft.begin();
tft.fillScreen(DISPLAY_WHITE);
}
void loop(void)
{
tft.drawCircle(0, 0, 20, DISPLAY_GREEN); //draw circle
delay(1000);
tft.fillCircle(0, 0, 20, DISPLAY_RED); //fill circle
delay(1000);
tft.fillScreen(DISPLAY_WHITE);
delay(1000);
}
Result

Was this article helpful?
