AllenCherry
Active member
Anyone who can help please:
I am using the ILI9341 display to draw 6 concentric circles, and I want to have 'cross hair' moving around over the circles.
The problem I am experiencing is that the 'cross hair' is erasing the circle, and to re-draw the circles each time is spoiling the 'smoothness' of the display update. The code is as follows:
#include "SPI.h"
#include "ILI9488_t3.h"
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
void setup()
{
tft.begin();
tft.fillScreen(ILI9488_BLACK);
tft.setOrigin(0,0);
//draw the 6 circles on the screen
tft.drawCircle(119, 160, 119, (ILI9488_WHITE));
tft.drawCircle(119, 160, 100, (ILI9488_WHITE));
tft.drawCircle(119, 160, 80, (ILI9488_WHITE));
tft.drawCircle(119, 160, 60, (ILI9488_WHITE));
tft.drawCircle(119, 160, 40, (ILI9488_WHITE));
tft.drawCircle(119, 160, 20, (ILI9488_WHITE));
}
void loop()
{
//draw the + and move it across and up the screen
for (int x = 50; x <= 255; x++)
{
for(int y = 50; y <= 255;y++)
{
tft.drawFastVLine(x, y-10,20,(ILI9488_WHITE));
tft.drawFastHLine(x-10, y,20,(ILI9488_WHITE));
delay(3);
//erase the cross by painting it the same as the background colour
tft.drawFastVLine(x, y-10,20,(ILI9488_BLACK));
tft.drawFastHLine(x-10, y,20,(ILI9488_BLACK));
//have to re-draw the circles - this slows everything down
tft.drawCircle(119, 160, 119, (ILI9488_WHITE));
tft.drawCircle(119, 160, 100, (ILI9488_WHITE));
tft.drawCircle(119, 160, 80, (ILI9488_WHITE));
tft.drawCircle(119, 160, 60, (ILI9488_WHITE));
tft.drawCircle(119, 160, 40, (ILI9488_WHITE));
tft.drawCircle(119, 160, 20, (ILI9488_WHITE));
}
}
}
Is there anyway to have the 'cross hair' moving across the background circles without erasing them when the cross hair is moved to a new position?
Thanks for any help,
Allen
I am using the ILI9341 display to draw 6 concentric circles, and I want to have 'cross hair' moving around over the circles.
The problem I am experiencing is that the 'cross hair' is erasing the circle, and to re-draw the circles each time is spoiling the 'smoothness' of the display update. The code is as follows:
#include "SPI.h"
#include "ILI9488_t3.h"
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
void setup()
{
tft.begin();
tft.fillScreen(ILI9488_BLACK);
tft.setOrigin(0,0);
//draw the 6 circles on the screen
tft.drawCircle(119, 160, 119, (ILI9488_WHITE));
tft.drawCircle(119, 160, 100, (ILI9488_WHITE));
tft.drawCircle(119, 160, 80, (ILI9488_WHITE));
tft.drawCircle(119, 160, 60, (ILI9488_WHITE));
tft.drawCircle(119, 160, 40, (ILI9488_WHITE));
tft.drawCircle(119, 160, 20, (ILI9488_WHITE));
}
void loop()
{
//draw the + and move it across and up the screen
for (int x = 50; x <= 255; x++)
{
for(int y = 50; y <= 255;y++)
{
tft.drawFastVLine(x, y-10,20,(ILI9488_WHITE));
tft.drawFastHLine(x-10, y,20,(ILI9488_WHITE));
delay(3);
//erase the cross by painting it the same as the background colour
tft.drawFastVLine(x, y-10,20,(ILI9488_BLACK));
tft.drawFastHLine(x-10, y,20,(ILI9488_BLACK));
//have to re-draw the circles - this slows everything down
tft.drawCircle(119, 160, 119, (ILI9488_WHITE));
tft.drawCircle(119, 160, 100, (ILI9488_WHITE));
tft.drawCircle(119, 160, 80, (ILI9488_WHITE));
tft.drawCircle(119, 160, 60, (ILI9488_WHITE));
tft.drawCircle(119, 160, 40, (ILI9488_WHITE));
tft.drawCircle(119, 160, 20, (ILI9488_WHITE));
}
}
}
Is there anyway to have the 'cross hair' moving across the background circles without erasing them when the cross hair is moved to a new position?
Thanks for any help,
Allen