FPS counter on the Arduino Uno/Contatore di fps sullo schermo lcd di arduino uno

ENGLISH:
Hi everyone,
I am new to the sector and I would like to write a code that shows me the fps that my video card does in real time on the lcd screen (16x2) of arduino uno. I have already written this but it shows the fps of the lcd screen instead of the video card.

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

long lastMillis = 0;
long fps = 0;

void setup() {
  lcd.begin(16, 2);
}

void loop() {
  if ((millis() - lastMillis) > 1000) {
    lcd.clear();

    lcd.setCursor(0, 0);
    lcd.print("SECONDI ");
    lcd.setCursor(0, 1);
    lcd.print("FPS ");

    lcd.setCursor(8, 0);
    lcd.print(millis()/1000);

    lcd.setCursor(4, 1);
    lcd.print(fps);
    fps = 0;
    lastMillis = millis();
  }
  fps = fps + 1;
}

Thanks in advance for your help.
Grazie in anticipo dell’aiuto.

OK.

Here's a question for you!

What video card are you talking about?

And what does it have to do - as I suspect it does not - with an Arduino? :roll_eyes:

I want to make a second screen to get an overview of the fps I do.

You mean?

Unfortunately, you are not making very clear what it is you are tying to achieve and why.

"Frames per second" is not particularly meaningful in regard to the 1602 or similar character LCD displays as on the one hand, you cannot read text particularly fast in any case, while these displays are inherently slow to update (mostly, slow to fade the previous image) and you can only move text in horizontal or vertical steps of single characters at a time.

In short, they are not really suitable for animation, which is why "frames per second" is not a useful criterion. Probably about five at most. :cold_sweat:

It's quite clear to me what @TzunamiGamer wants to accomplish. They have a video card on their computer that is updating the monitor at some FPS. They want that FPS displayed on an LCD controlled by an Uno.

What is needed:

A way for your computer to get the FPS of the video card. You need to start with this.

A way for your computer to communicate that data to the Uno. The most obvious option is to communicate over serial, since the Uno has this capability built in. There are other options, including Ethernet, WiFi, and Bluetooth, but these will require the necessary communication hardware to be attached to the Uno.

Once you have that set up, the sketch that runs on the Uno to display the data is simple. So a lot of this project is about setting things up on your computer.

The problem here is that “video card” and “Arduino UNO with LCD screen” have no obvious connection. :cold_sweat:

It would seem simpler - much simpler in fact - to have the FPS displayed in a small modal box on the secondary monitor of the video card (and don’t tell me you do not have a secondary monitor! :sunglasses: ) There must be some program already available to do this, surely!

Life is simple with an Uno: there is no graphics card or video card. The processor sends instructions to the chip on the LCD and that is it. No frills.

If you want to create an animation, use a 128*64 LCD or a 220x480 TFT. With these devices you can experiment with frame rates.

See Muybridges horse galloping on the Arduino at Eadweard Muybridge’s galloping horse on Arduino 128*64 LCD, OLED and TFT displays – thesolaruniverse

I think I am agreeing with Pert that what "TzunamiGamer" is wanting with his indicative "handle" is not to animate anything using an Arduino, but to use it purely as an attachment to his gaming computer to reassure him that he is getting the performance from his video gaming hardware that he so dearly paid for!