Slow update speed in firebase while using ESP8266

Hello,
I'm learning the arduino from quite a while for my project, previously I was working on Arduino UNO for simple things and manuplation of variables and getting analog voltages from my electronic circuits.

Now, I decided to push those simple output values on the app, for that I'm uploading my int, float (output) values int the firebase. While I'm doing that I observed that the values are updating at a very-very low speed (around in ten seconds), and which is simple int and float values.
although I'm using this delay element, previously I was not using this
it is making no effect

Here is my code:

#include <Arduino.h>
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif
#include <Firebase_ESP_Client.h>

//Provide the token generation process info.
#include "addons/TokenHelper.h"   //Provide the RTDB payload printing info and other helper functions.
#include "addons/RTDBHelper.h"

// Insert your network credentials
#define WIFI_SSID "********"
#define WIFI_PASSWORD "********"

// Insert Firebase project API Key
#define API_KEY "*******************************"

// Insert RTDB URLefine the RTDB URL */
#define DATABASE_URL "*****************************************"

//Define Firebase Data object
FirebaseData fbdo;

FirebaseAuth auth;
FirebaseConfig config;

//unsigned long sendDataPrevMillis = 0;
int count = 0;
bool signupOK = false;

void setup() {
  Serial.begin(115200);
  //Wi-Fi connection
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("Connecting to Wi-Fi");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(300);
  }
  Serial.println();
  Serial.print("Connected with IP: ");
  Serial.println(WiFi.localIP());
  Serial.println();

  /* Assign the api key (required) */
  config.api_key = API_KEY;

  /* Assign the RTDB URL (required) */
  config.database_url = DATABASE_URL;

  /* Sign up */
  if (Firebase.signUp(&config, &auth, "", "")) {
    Serial.println("ok");
    signupOK = true;
  }
  else {
    Serial.printf("%s\n", config.signer.signupError.message.c_str());
  }

  /* Assign the callback function for the long running token generation task */
  config.token_status_callback = tokenStatusCallback;    //see addons/TokenHelper.h

  Firebase.begin(&config, &auth);
  Firebase.reconnectWiFi(true);
}

void loop() {
  Firebase.RTDB.setInt(&fbdo, "test/bpm", 60 + random(0, 40));

  // Write an Float number on the database path test/float
  Firebase.RTDB.setFloat(&fbdo, "test/sp", 95.0 + random(0, 5.0));
delay(1500);   //
}
[/code]```


Thank in Advance.
Aniket

Delay always increase loop time.
Read Arduino/reference/random.
I'm pretty sure it only works win int variables, not float variables.

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