Flickering OLED

Try this. I cannot test it but it compiles

#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>

#define TFT_MOSI 23  // Data out
#define TFT_SCLK 18  // Clock out
#define TFT_CS 22    //
#define TFT_DC 21    //
#define TFT_RST -1   // pin# 2

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

int Hz;
int previousHz;

void setup()
{
    Serial.begin(115200);

    tft.init(170, 320);  // high, with
    tft.setRotation(3);  // Adjust rotation as needed (0-3),0 = viertical, 1= horyzontal upside down, 2= viertical 180 deg , 3=horyzontal normal,
    tft.fillScreen(ST77XX_BLUE);
    tft.setTextWrap(false);  // Disable text wrapping
    tft.setTextSize(4);      // Set text size

    pinMode(12, INPUT_PULLUP);  //amp ++
    pinMode(14, INPUT_PULLUP);  // amp --
    pinMode(2, INPUT_PULLUP);
}

void loop()
{
    if (digitalRead(12) == LOW)
    {
        Hz++;
    }
    if (digitalRead(14) == LOW)
    {
        Hz--;
    }

    if (Hz != previousHz)
    {
        tft.setCursor(0, 0);
        tft.setTextColor(ST77XX_BLUE);    // background color
        tft.print(previousHz);            //erase previous value
        tft.setTextColor(ST77XX_YELLOW);  //text is yellow
        tft.print(Hz);                    //print new value
    }
    previousHz = Hz;											//save previous value
}