Error: Blynk does not name a type

Hello.
Have been looking on the forum and found a couple of suggestions that are not working, so asking here. In short, we are following an arduino project (healthwatch) and will update that project when this is working. For now, we are at near final steps and uploaded the ‘newest’ code available on that project site and getting errors. Two in particular.

First error is related to ‘Blynk’ was not declared in that scope (which I think is fixed with a similar line of code related to this for the DPS310).

Second error, which I cannot get fixed is “Blynk does not name a type”. From the forum responses, this looks like it is related to the libraries, so I reinstalled these manually without success. Also tried moving the files to a ‘higher level’ as suggested in another thread. Again, no luck.

Working on this with my son so any help is greatly appreciated.

Area of code error:

#include <ESP8266_Lib.h>

#include <Blynk.h>
Blynk;  //declare an instance of the Blynk object

#include <Dps310.h>

Dps310 dps310;  // declare an instance of the Dps310 object

and the Full code is as follows:

#include <ESP8266_Lib.h>

#include <Blynk.h>
Blynk;  //declare an instance of the Blynk object

#include <Dps310.h>

Dps310 dps310;  // declare an instance of the Dps310 object

#define BLYNK_PRINT Serial

char auth[] = "YourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

const unsigned char pressureLength = 50;
unsigned char pressureCount = 0;
long int pressure[pressureLength];
unsigned char temperatureCount = 0;
const unsigned char temperatureLength = 50;
long int temperature[temperatureLength];

/*these thresholds will change according to where u currecntly are, 
these values worked perfetly in our coastal region where average temperatures were
34 degrees celsius
*/
int pressureFallingThresh = 1;
int pressureSleepingThresh = 4;
int tempFeverThresh = 39;
int pressureJogThresh = 5;

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  while (!Serial);
  dps310.begin(Wire);
  
  int ret = dps310.setInterruptPolarity(1);
  ret = dps310.setInterruptSources(1, 0, 0);
  //clear interrupt flag by reading
  dps310.getIntStatusFifoFull();

  int interruptPin = 3;
  pinMode(interruptPin, INPUT);
  attachInterrupt(digitalPinToInterrupt(interruptPin), onFifoFull, RISING);

  //start of a continuous measurement just like before
  int temp_mr = 3;
  int temp_osr = 2;
  int prs_mr = 1;
  int prs_osr = 3;
  ret = dps310.startMeasureBothCont(temp_mr, temp_osr, prs_mr, prs_osr);
  if (ret != 0)
  {
    Serial.print("Init FAILED! ret = ");
    Serial.println(ret);
  }
  else
  {
    Serial.println("Init complete!");
  }
}


void loop()
{
  Blynk.run();
  
  Serial.println("loop running");
  delay(500);
  
  if (pressureCount == pressureLength && temperatureCount == temperatureLength)
  {
    //print results
    Serial.println();
    Serial.println();
    Serial.print(temperatureCount);
    Serial.println(" temperature values found: ");
    for (int i = 0; i < temperatureCount; i++)
    {
      Serial.print(temperature[i]);
      if (temperature[i] > tempFeverThresh){
        feverEmail();
      }
      Serial.println(" degrees of Celsius");
    }
    Serial.println();
    Serial.print(pressureCount);
    Serial.println(" pressure values found: ");
    for (int i = 0; i < pressureCount; i++)
    {
      Serial.print(pressure[i]);
      if (pressure[i] < pressureFallingThresh){
        fallEmail();
      }
      else if (pressure[i] < pressureSleepingThresh && pressure[i] < pressureFallingThresh){
        wakingUpEmail();
      }
      Serial.println(" Pascal");
    }
    Serial.println();
    Serial.println();
    //reset result counters
    pressureCount = 0;
    temperatureCount = 0;
  }
 
}

void feverEmail()
{
  Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
  Blynk.email("your_email@mail.com", "Subject: your patient has fever", "your patient has a fever and his/ her body temp is", temperature);
}

void fallEmail()
{
  Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
  Blynk.email("your_email@mail.com", "Subject: your patient just had a fall", "your patient just had a fall and requires assistance");
}

void wakingUpEmail()
{
  Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
  Blynk.email("your_email@mail.com", "Subject: your patient has just left his/her bed", "your patient has a just left the bed for unknown reasons, he/she needs assistance");
}

//interrupt handler
void onFifoFull()
{
  //message for debugging
  Serial.println("Interrupt handler called");

  //clear interrupt flag by reading
  dps310.getIntStatusFifoFull();

  //calculate the number of free indexes in the result arrays
  unsigned char prs_freespace = pressureLength - pressureCount;
  unsigned char temp_freespace = temperatureLength - temperatureCount;
  //read the results from Dps310, new results will be added at the end of the arrays
  dps310.getContResults(&temperature[temperatureCount], temp_freespace, &pressure[pressureCount], prs_freespace);
  //after reading the result counters are increased by the amount of new results
  pressureCount += prs_freespace;
  temperatureCount += temp_freespace;
}
Blynk;  //declare an instance of the Blynk object


Dps310 dps310;  // declare an instance of the Dps310 object

Do you see a difference between these two lines?
One declares a variable named dps310 to be of type Dps310. The other could declare some variable to be of type Blynk, but it seems to be missing the name of the variable. Because you presumably are going to need this variable later on, this is a very serious problem.

I don't know this library, so it is possible that things such as Blynk.begin and Blynk.email work as is. More likely, you should have declared a variable blynk and called blynk.begin and blynk.email . Notice that the case (upper case versus lower case) is significant.

(deleted)

Hello Vaj4088 and spycatcher2k. Truly appreciate your insight. Still not working.

Spycatcher2k, I did follow your suggestion to look at the examples supplied with the library. Still having issues. May help to share that I am attempting to help my son who wanted to build this smartwatch project (from Arduino site). Last comments on that site are from several months ago. Copied the code from that site. Attempted to get a response from the author and no success. So…as a noobie, I am struggling with helping as much as I thought I might be able to… sure appreciate the direction to the examples and am learning a lot. Really just want the code to work since we are copying directly from the project AND, I was able to get the first part to work (author shared two tabs under code…one for testing hardware (working) and the other is the ‘full project code’ (not working).

Vaj4088, I do see the difference in the lines AFTER your insight. Using this and looking at the examples as suggested, I am not finding how to declare correctly. I have tried adding the following–still with no success.

#include <Blynk.h>
Blynk Blynk.begin; //declare an instance of the Blynk object

Will keep looking and really appreciate any further insight.
Thank you.

Blynk Blynk.begin;  //declare an instance of the Blynk object

And look at the one that's right:

Dps310 dps310;  // declare an instance of the Dps310 object

It just gives the object a name. It doesn't have any dot notation in it. Why did you add the ".begin" to yours?

The larger question is, is Blynk an object to create? Do you even need to create that one? When the code uses it with the capital B then it looks like you don't create that one, you probably are supposed to use one that is created in the class.

See this is the problem with taking some huge complicated project as your first go and not bothering to learn anything about it first. You're a bit like the guy who decided to learn to swim by jumping off the cruise ship in the middle of the ocean. (Spoiler - he didn't make it back to shore.)

Maybe the better lesson for the son would be that sometimes to get to the thing you want you have to go through a bunch of boring stuff first. If you want to be able to build a smart watch then you have to be willing to "pay your dues" and do a little learning first. if you don't then you are limited to only being able to build what you have good working instructions and support for. If the instructions you are following aren't good or the person who made them isn't available then you're just out of luck if you haven't bothered to learn anything else about it and are just interested in copying.

Hello Delta_G, In response to your question..."why did you add the ".begin" to yours?"
Shortest answer is this was an attempt at a solution (and posting of this attempt) per following the suggestion (as I understood) from vaj4088. My understanding from the last paragraph of his post.

Regarding your larger question...the error I am 'seeing' is 'Blynk' does not name a type. In addition, in the error verbiage I see that 'Blynk' was not declared in this scope. In the process of troubleshooting a related issue, the solution was to 'declare' the object and it worked in that instance...so I thought it might here too.

Regarding the 'huge complicated project as your first go', I would only offer that my impression was that IF the coding is provided, then the project would NOT be a 'huge complicated project'. Now, once into the project and after ordering all parts and having them all working...we thought we could just 'copy the code' and have a working prototype which we could improve further over time. We are learning a lot...and my hope is that we have success in the end, which will really show that the hard work and such is 'worth it'.

Bottom line, thank you for your feedback and we will continue to look for insight, answers and feedback from you and others. Thank you.

Now, once into the project and after ordering all parts and having them all working...we thought we could just 'copy the code' and have a working prototype which we could improve further over time.

And that's the problem I was eluding to. As long as someone has given you everything then you're fine. But now you've run into something that they didn't give you right. And now you're stuck because all you know how to do is copy others. If you'd spend a little time, a few hours, with a C++ tutorial and working through some of the educational, if boring, examples then you'll have a much better grasp on the language and be in a much better place to approach this.

Right now all you can do is guess and ask us. Wouldn't it be better if you had at least a vague inkling at what you were doing? It doesn't take long. A few hours with a good C++ tutorial. A couple of days at worst. The language isn't that hard if you're willing to follow a structured tour first.

I know that sounds like a lot of time and work, but I promise it will take a LOT less time to get to a working solution that way than with your current guess and hack method. Coding isn't something you can learn by the seat of your pants.

As usual, Delta_ G has it right.