Trouble with getting Flow Meter to display on (SSD1306 OLED 128 x 64 Display)

I am busy with my first Arduino project and i have hit a brick wall, sort of. Took me half a day to get to this point but haven’t progressed past it in a week. I don’t want to just give up, and i know the solution to my problem will be simple. I just cant figure it out.

Aurduino Uno R3 - (connected to windows pc via usb)
Water Flow Meter – Plastic 1/2 inch Hall sensor - (Wiring diagram attached)
OLED 0.96" Display I2C White (SSD1306 OLED 128 x 64) - Wiring(GND - GND,VCC -3.3v,SCL-A5,SDA-A4)

I have followed a few wiring tutorials and i am pretty confident its been done properly.

I have (Adafruit_GFX) and (Adafruit_SSD1306) libraries installed.

I can get the display working without the flowmeter . I can get the flowmeter displaying in the serial window what i want it to display. Easy stuff.

Cant get the flowmeter to display on the Oled Display though.

Here is the code for Flowmeter:

volatile int NbTopsFan;            //measuring the rising edges of the signal
int Calc; 
int Calc2;
int Calc3;
int hallsensor = 2;                //The pin location of the sensor

void rpm ()                        //This is the function that the interupt calls
{
  NbTopsFan++;                     //This function measures the rising and falling edge of signal
}                                  //The setup() method runs once, when the sketch starts

void setup() 

{
 pinMode(hallsensor, INPUT);       //initializes digital pin 2 as an input
 Serial.begin(9600);               //This is the setup function where the serial port is initialised
 attachInterrupt(0, rpm, RISING);  //and the interrupt is attached
}
                                   // the loop() method runs over and over again
                                   // as long as the Arduino has power
void loop () 
{
 NbTopsFan = 0;                     //Set NbTops to 0 ready for calculations
 sei();                             //Enables interrupts
 delay (1000);                      //Wait 1 second
 cli();                             //Disable interrupts
 Calc = (NbTopsFan * 60 / 7.5);          //(Pulse frequency x 60) / 7.5Q = flow rate in L/hour
 Calc2 = (NbTopsFan * 60 / 7.5)/60;      //(Pulse frequency x 60) / 7.5Q = flow rate in L/hour
 Calc3 = (((NbTopsFan * 60 / 7.5)/60)/60)*1000; //(Pulse frequency x 60) / 7.5Q = flow rate in L/hour
 Serial.print (Calc, DEC);               //Prints the number calculated above
 Serial.println (" L/hour");             //Prints "L/hour" and returns a new line
 Serial.print (Calc2, DEC);              //Prints the number calculated above
 Serial.println (" L/min");              //Prints "L/min" and returns a new line
 Serial.print(Calc3, DEC);             //Prints the number calculated above
 Serial.println (" ml/sec");              //Prints "ml/sec" and returns a new line
 Serial.println("------");               //Prints the number calculated above
}

Here is the code for (SSD1306 OLED 128 x 64 ) with the flowmeter code.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2


#define LOGO16_GLCD_HEIGHT 64 
#define LOGO16_GLCD_WIDTH  128 
static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

//------------------

volatile int NbTopsFan;            //measuring the rising edges of the signal
int Calc; 
int Calc2;
int Calc3;
int hallsensor = 2;                //The pin location of the sensor

void rpm ()                        //This is the function that the interupt calls
{
  NbTopsFan++;                     //This function measures the rising and falling edge of signal
}                                  //The setup() method runs once, when the sketch starts

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

  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
  display.clearDisplay();
  // init done
  
//--
  pinMode(hallsensor, INPUT);       //initializes digital pin 2 as an input
  Serial.begin(9600);               //This is the setup function where the serial port is initialised
  attachInterrupt(0, rpm, RISING);  //and the interrupt is attached
//--  
    
}

void loop() {
   
   NbTopsFan = 0;                     //Set NbTops to 0 ready for calculations
 sei();                             //Enables interrupts
 delay (1000);                      //Wait 1 second
 cli();                             //Disable interrupts
 Calc = (NbTopsFan * 60 / 7.5);          //(Pulse frequency x 60) / 7.5Q = flow rate in L/hour
 Calc2 = (NbTopsFan * 60 / 7.5)/60;      //(Pulse frequency x 60) / 7.5Q = flow rate in L/hour
 Calc3 = (((NbTopsFan * 60 / 7.5)/60)/60)*1000; //(Pulse frequency x 60) / 7.5Q = flow rate in L/hour
 Serial.print (Calc, DEC);               //Prints the number calculated above
 Serial.println (" L/hour");             //Prints "L/hour" and returns a new line
 Serial.print (Calc2, DEC);              //Prints the number calculated above
 Serial.println (" L/min");              //Prints "L/min" and returns a new line
 Serial.print(Calc3, DEC);             //Prints the number calculated above
 Serial.println (" ml/sec");              //Prints "ml/sec" and returns a new line
 Serial.println("------");               //Prints the number calculated above
 display.display();
   delay(1000);
   display.clearDisplay(); 
      
}

I know there is problems with this code, but i am still figuring it out.
I have never posted on a forum like this but i feel like i am barking up a forest of wrong tress at the moment.

Feel free to let me know if i made mistakes in the post or anything like that.

Thank you .

Have you looked at the example code that came with the Adafruit_SSD1306 library?

Lots of the example sketches print text to the OLED.

Thank you for the reply.

I have played with those examples quite a bit. Making text "static text", drawing lines, circles and so on. It all works fine. Trouble im having is displaying my changing calculation, or "variable", if that makes sense. The answer to the calculation of the Flowmeter. I have looked at examples of this code in tutorials but i cant find one with my specific screen type. When i try out the suggested code it newer works, so i am missing something here. Gap in my understanding.

I will go look those examples up again.

Thank you.

This is the part of the sample code I think you need to consider:

 // text display tests
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.print("Connecting to SSID\n'adafruit':");
  display.print("connected!");
  display.println("IP: 10.0.1.23");
  display.println("Sending val #0");
  display.setCursor(0,0);
  display.display(); // actually display all of the above

Thank you for that, exactly what i needed. Just integrated my values into the example and like magic, it works.

That code wasn't on my copy of the example library. Strange.

Thank you again for the help.