Please help incoporate timer into my sketch

I’m building a remote car with an ESP8266 and a raspberry Pi. I’m trying to understand how replace delays with timer since I’ve read that delays are bad for the Blynk servers. I’m using 2 delays, first one is display 1 and second one in display2. Can someone please show me how to add it to this sketch and also I’ve been told that Blynk should be the only one in Void Loop but not sure how to separate from my Oled display output info. Thanks for any help.

//#include <SimpleTimer.h>
#include <Wire.h>
#include <Adafruit_INA219.h>
#include <Adafruit_GFX.h>                           // grafix lib for the OLED
#include <Adafruit_SSD1306.h>                       // I2C OLED lib
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SPI.h>
#include <Servo.h>

char auth[] = "";
char ssid[] = "";
char pass[] = "";

Adafruit_INA219 ina219_A;
Adafruit_INA219 ina219_B(0x41);

#define LED     D4

Adafruit_SSD1306 display1(OLED_RESET);               //OLED lib call
Adafruit_SSD1306 display2(OLED_RESET);

//SimpleTimer timer;
Servo servo;

void setup()
  pinMode(LED, OUTPUT);
  Blynk.begin(auth, ssid, pass);
  servo.attach(15); // 15 means D8 pin of ESP8266
  uint32_t currentFrequency;
  ina219_A.begin(); // Initialize first board (default address 0x40)
  ina219_B.begin(); // Initialize second board with the address 0x41

  display1.begin(SSD1306_SWITCHCAPVCC, 0x3C);       // start the oled @ address 0x3c
  display1.display();                               // show buffer
  display1.clearDisplay();                          // clear display

  display2.begin(SSD1306_SWITCHCAPVCC, 0x3D);
  display2.display();                               // show buffer
  display2.clearDisplay();                          // clear display

void loop()
  float shuntvoltage = 0;
  float shuntvoltage2 = 0;
  float busvoltage = 0;
  float busvoltage2 = 0;
  float current_mA = 0;
  float current_mA2 = 0;
  float loadvoltage = 0;
  float loadvoltage2 = 0;
  float power = loadvoltage * current_mA;
  float power2 = loadvoltage2 * current_mA2;

  shuntvoltage = ina219_A.getShuntVoltage_mV();
  busvoltage = ina219_A.getBusVoltage_V();
  current_mA = ina219_A.getCurrent_mA();
  shuntvoltage2 = ina219_B.getShuntVoltage_mV();
  busvoltage2 = ina219_B.getBusVoltage_V();
  current_mA2 = ina219_B.getCurrent_mA();
  loadvoltage = busvoltage + (shuntvoltage / 1000);
  loadvoltage2 = busvoltage2 + (shuntvoltage2 / 1000);
  power = loadvoltage * current_mA;
  power2 = loadvoltage2 * current_mA2;

  display1.setTextSize(1);                           //set text size to 1
  display1.setTextColor(WHITE);                      //set color to white
  display1.setCursor(0, 0);                          //set cursor to upper left

  display1.println("3S disp1  Batt Status");

  display1.setTextSize(2);                           //set text size to 1
  display1.setTextColor(WHITE);                      //set color to white

  display1.setCursor(0, 16);
  display1.print(busvoltage); display1.println("V");
  display1.print(current_mA); display1.println("mA");
  display1.print(power); display1.println("mW");
  display1.display();                                //show what is in the buffer
  delay(100);                                      //wait one second
  display1.clearDisplay();                           //clear the display

  display2.setTextSize(1);                           //set text size to 1
  display2.setTextColor(WHITE);                      //set color to white
  display2.setCursor(0, 0);                          //set cursor to upper left

  display2.println("2S disp2  Batt Status");

  display2.setTextSize(2);                           //set text size to 1
  display2.setTextColor(WHITE);                      //set color to white
  display2.setCursor(0, 16);

  display2.print(busvoltage2); display2.println("V");
  display2.print(current_mA2); display2.println("mA");
  display2.print(power2); display2.println("mW");

  display2.display();                                //show what is in the buffer
  delay(100)                                     //wait one second
  display2.clearDisplay();                           //clear the display;

Hello, We don’t really exist to help write programs, rather we are here to help promote Blynk and assist others learn how Blynk commands work etc.

You have some of the basics apparent in your code, however what you need is timers. Both to remove some of the function calls from the main loop, as they are running hundreds of times a second… and to assist with timed action with any OLED displays and controls.

Study up on this link for SimpleTimer, which has been “built into” the Blynk library under the name BlynkTimer. Also search this forum for references like BlynkTimer and delays without blocking, PIR, etc.

BlynkTimer is the same as the widely used SimpleTimer library, in that it works more elegantly than manually manipulating millis() and it is NOT dependent on a connection to a Blynk Server, and also fixes some minor issues with the original library.

A typical Interval Timer layout includes a definition, timer setup (pointing to a function) and a timer call in the void loop():

BlynkTimer Mytimer; // Sets up a timer object named Mytimer (could be any name)

MyOLEDtimer.setInterval(250L, MyOLEDFunction);  // Goes in Setup() and will call the void MyOLEDFunction() every 250 milis (1/4 second - adjust to your needs).  Blynk Timer allows up to 16 of these same object named timers pointing to differing functions

void MyOLEDFunction() 
// Put all your OLED stuff here

void loop()
{;;  // This goes in the void loop() so the BlynkTimer library can run.

This makes perfect sense. Thank you very much.