Current operational code is no longer compiling

I have code that is currently operational in a Photon, is was compiled and loaded a couple months ago. I went to update the Blynk token only and re-compile, I get the following errors as listed below. I am curious if something changed in the IDE app ? Sorry in advance if this is a real simple issue. Appreciate any help from the community.
Error List:
dht22_blynk_temp.ino: In function ‘void setup()’:
dht22_blynk_temp.ino:16:33: error: ‘reading’ was not declared in this scope
dht22_blynk_temp.ino: In function ‘void loop()’:
dht22_blynk_temp.ino:21:3: error: ‘reading’ was not declared in this scope
dht22_blynk_temp.ino: In function ‘void setup()’:
dht22_blynk_temp.ino:55:6: error: redefinition of 'void setup()'
dht22_blynk_temp.ino:15:6: error: ‘void setup()’ previously defined here
dht22_blynk_temp.ino: In function ‘void loop()’:
dht22_blynk_temp.ino:74:6: error: redefinition of 'void loop()'
dht22_blynk_temp.ino:20:6: error: ‘void loop()’ previously defined here
dht22_blynk_temp.ino:119:38: error: ‘reading’ was not declared in this scope

Here is the code from a temperature/humidity/light sensor project that has been operating properly for the last couple of months:

// This #include statement was automatically added by the Particle IDE.
#include <photon_book.h>

// This #include statement was automatically added by the Particle IDE.
#include <PietteTech_DHT.h>

// This #include statement was automatically added by the Particle IDE.
#include <blynk.h>

double volts = 0.0;
int analogPin = A0;

void setup() {
   Particle.variable("analog", &reading, INT);
   Particle.variable("volts", &volts, DOUBLE);
}

void loop() {
  reading = analogRead(analogPin);
  volts = reading * 3.3 / 4096.0;
  delay(20*1000);
}


// system defines
#define DHTTYPE  DHT22              // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPIN   4         	    // Digital pin for communications
#define DHT_SAMPLE_INTERVAL   60000  // Sample every minute

//declaration
void dht_wrapper(); // must be declared before the lib initialization

// Lib instantiate
PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);

// globals
unsigned int DHTnextSampleTime;	    // Next time we want to start sample
bool bDHTstarted;		    // flag to indicate we started acquisition
int n;                              // counter

//this is coming from http://www.instructables.com/id/Datalogging-with-Spark-Core-Google-Drive/?ALLSTEPS
char resultstr[64]; //String to store the sensor data


//DANGER - DO NOT SHARE!!!!
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // Put your blynk token here
//DANGER - DO NOT SHARE!!!!

char VERSION[64] = "0.04";

#define READ_INTERVAL 60000

void setup()
{

  Blynk.begin(auth);
 
 DHTnextSampleTime = 0;  // Start the first sample immediately
 Particle.variable("result", resultstr, STRING);

 Particle.publish("DHT22 - firmware version", VERSION, 60, PRIVATE);
 
}

// This wrapper is in charge of calling
// must be defined like this for the lib work
void dht_wrapper() {
    DHT.isrCallback();
}

void loop()
{

  Blynk.run(); // all the Blynk magic happens here
 

  // Check if we need to start the next sample
  if (millis() > DHTnextSampleTime) {
      
	if (!bDHTstarted) {		// start the sample
	    DHT.acquire();
	    bDHTstarted = true;
}

 if (!DHT.acquiring()) {		// has sample completed?

  float temp = (float)DHT.getFahrenheit();
  int temp1 = (temp - (int)temp) * 100;

  char tempInChar[32];
  sprintf(tempInChar,"%0d.%d", (int)temp, temp1);
  Particle.publish("The temperature from the dht22 is:", tempInChar, 60, PRIVATE);

  //virtual pin 1 will be the temperature
  Blynk.virtualWrite(V1, tempInChar);
 
  //google docs can get this variable
  sprintf(resultstr, "{\"t\":%s}", tempInChar);

  float humid = (float)DHT.getHumidity();
  int humid1 = (humid - (int)humid) * 100;

  sprintf(tempInChar,"%0d.%d", (int)humid, humid1);
  Particle.publish("The humidity from the dht22 is:", tempInChar, 60, PRIVATE);

  //virtual pin 2 will be the humidity
  Blynk.virtualWrite(V2, tempInChar);

  n++;  // increment counter
  bDHTstarted = false;  // reset the sample flag so we can take another
  DHTnextSampleTime = millis() + DHT_SAMPLE_INTERVAL;  // set the time for next sample
  
  //Light meter??
  Particle.publish("the volts are:", reading, 60, PRIVATE);
  Blynk.virtualWrite(V3, analogPin);
 }
}
}
```

You have two sets of setup() and loop() in there.
I guess a copy/paste error

2 Likes