Error while compiling the code

full code, error= 'sendUptime' was not declared in this scope
pls help

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
BlynkTimer timer;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "5iXYo8D2VpHQ0q84BLAF8JRL7YgKLBb6";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Chandra";
char pass[] = "passw0rd@22";

#define MQ2 34
#define GREEN 16
#define RED 17
int sensorValue = 0;
boolean state = false;

void setup()
{
timer.setInterval(1000L, sendUptime);
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(MQ2, INPUT);
pinMode(GREEN, OUTPUT);
pinMode(RED, OUTPUT);

}

void sendUptime()
{

sensorValue = analogRead(MQ2);
Blynk.virtualWrite(V1, sensorValue);
Serial.println(sensorValue);

if (sensorValue > 600)
{
Blynk.notify("Gas Detected!");
digitalWrite(GREEN, LOW);
digitalWrite(RED, HIGH);
}

else
{
digitalWrite(GREEN, HIGH);
digitalWrite(RED, LOW);
}
}

void loop()
{
Blynk.run();
timer.run();
}

error:
'sendUptime' was not declared in this scope

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

try putting

void sendUptime();

just above setup()

The code compiles for me

Which board type have you got selected in the IDE ?

Please post the full error message copied using the "Copy error message" button in the IDE and use code tags when you post it

Arduino: 1.8.19 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

In file included from C:\Users\Personal\Documents\Arduino\final\final.ino:11:0:

C:\Users\Personal\Documents\Arduino\final\mq2.h: In function 'void setup()':

mq2.h:25:30: error: 'sendUptime' was not declared in this scope

 timer.setInterval(1000L, sendUptime);

                          ^

C:\Users\Personal\Documents\Arduino\final\final.ino: At global scope:

final:13:11: error: redefinition of 'char auth []'

char auth[] = BLYNK_AUTH_TOKEN;

       ^

In file included from C:\Users\Personal\Documents\Arduino\final\final.ino:11:0:

C:\Users\Personal\Documents\Arduino\final\mq2.h:9:6: note: 'char auth [33]' previously defined here

char auth[] = "5iXYo8D2VpHQ0q84BLAF8JRL7YgKLBb6";

  ^

final:14:11: error: redefinition of 'char ssid []'

char ssid[] = "Chandra";

       ^

In file included from C:\Users\Personal\Documents\Arduino\final\final.ino:11:0:

C:\Users\Personal\Documents\Arduino\final\mq2.h:14:6: note: 'char ssid [8]' previously defined here

char ssid[] = "Chandra";

  ^

final:15:11: error: redefinition of 'char pass []'

char pass[] = "passw0rd@22";

       ^

In file included from C:\Users\Personal\Documents\Arduino\final\final.ino:11:0:

C:\Users\Personal\Documents\Arduino\final\mq2.h:15:6: note: 'char pass [12]' previously defined here

char pass[] = "passw0rd@22";

  ^

final:105:12: error: redefinition of 'BlynkTimer timer'

BlynkTimer timer;

        ^

In file included from C:\Users\Personal\Documents\Arduino\final\final.ino:11:0:

C:\Users\Personal\Documents\Arduino\final\mq2.h:5:12: note: 'BlynkTimer timer' previously declared here

BlynkTimer timer;

        ^

C:\Users\Personal\Documents\Arduino\final\final.ino: In function 'void setup()':

final:107:6: error: redefinition of 'void setup()'

void setup() //Setup function - only function that is run in deep sleep mode

  ^

In file included from C:\Users\Personal\Documents\Arduino\final\final.ino:11:0:

C:\Users\Personal\Documents\Arduino\final\mq2.h:23:6: note: 'void setup()' previously defined here

void setup()

  ^

C:\Users\Personal\Documents\Arduino\final\final.ino: In function 'void loop()':

final:136:6: error: redefinition of 'void loop()'

void loop() //Loop function

  ^

In file included from C:\Users\Personal\Documents\Arduino\final\final.ino:11:0:

C:\Users\Personal\Documents\Arduino\final\mq2.h:55:6: note: 'void loop()' previously defined here

void loop()

  ^

Multiple libraries were found for "Adafruit_SSD1306.h"

Used: C:\Users\Personal\Documents\Arduino\libraries\Adafruit_SSD1306

Not used: C:\Users\Personal\Documents\Arduino\libraries\Adafruit_SSD1306_Wemos_Mini_OLED

Multiple libraries were found for "WiFi.h"

Used: C:\Users\Personal\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\libraries\WiFi

Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

Not used: C:\Users\Personal\Documents\Arduino\libraries\WiFiNINA

exit status 1

'sendUptime' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Have you got more than one tab in the IDE, each with code in them ?

ok
i will try

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

yes
there are two tabs

That is the cause of the redefinition errors because the IDE will try to compile the code in all of the tabs

Delete the second tab or the code in it or comment out all of the code in the second tab

hi
now its showing error compiling for esp32 module
and also iam unable to see my espressif esp32 library which i have previously installed
what to do???

If you are still using the code from your original post then please post the full error message but use code tags as previously requested.

If you have changed the code then post the new version as well as the full error message

So i wanted to merge two codes which I have could you help?

Start by posting the 2 sketches and explaining what you want the combined sketch to do

Which Arduino are you using ?

hi so I wanted to add a new code to my existing code file

I wanted to merge two codes which I have could you help?

As I said

I am using esp32

So basically building an indoor air quality monitoring with c02, temperatures pressure humidity monitoring
I can see the above parameters on my phone through blynk cloud

Only i want to add a mq2 sensor with one green, red led and buzzer
Also
to monitor on my phn

Could you help?

Any reply?

I will do my best to help when you post your best effort at combining the 2 sketches that you have still not posted