Clearing Arduino GFX st7735 display bitmap


Hello, i have an st7735 display here with my arduino nano and my goal is to control the movement of arrow drawn using a tft.bitmap. But when i try to move the coordinates of the arrow bitmap it prints a new arrow and the old arrow remains in the display. Is there a way to update the arrow position and removing the arrow that was in the previous x,y coordinates ?

Here is my code for the above program:

#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>
#include <Joystick.h>
#include <AxisJoystick.h>

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

void setup() {
  Serial.begin(9600);
  joystic = new AxisJoystick(SW_PIN, VRX_PIN, VRY_PIN);
  joystic->calibrate(ARDUINO_ADC_MIN, ARDUINO_ADC_MAX, AXES_DEVIATION);
  tft.initR(INITR_BLACKTAB);
  tft.setTextColor(WHITE);
  tft.initR (INITR_BLACKTAB);
  tft.setRotation (0);
  tft.fillScreen (BLACK);
  tft.setCursor(0, 0);
  canvas.setTextSize(2);
  canvas.println("Welcome to Art Buddy");
  tft.drawBitmap(0, 32, canvas.getBuffer(), 128, 32, BLACK, GREEN);
  tft.setTextSize(1);
  tft.setCursor(0,90);
  tft.print("---- Select mode ----");
  tft.setCursor(40, 130);
  tft.print("Auto");
  tft.setTextSize(1);
  tft.setCursor(40, 110);
  tft.print("Manual");
  tft.drawBitmap (90, 110, left_15, 15, 15, BLACK, WHITE);
}

void loop() {
  if(joystic->readVRy() < 700)
  {
      tft.drawBitmap(90, 110, left_15, 15, 15, BLACK, WHITE);
  }
  else if(joystic->readVRy() > 700)
  {
      tft.drawBitmap(90, 130, left_15, 15, 15, BLACK, WHITE);
  }
}

No, there is no any dedicated way to "move" bitmap on the screen.
To remove the arrow on previous position you have to redraw the previous arrow in a background color or redraw the entire line

okay thankyou !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.