Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

expected constructor, destructor, or type conversion before '(' token

Status
Not open for further replies.

parameshwari

Newbie level 1
Newbie level 1
Joined
Sep 13, 2018
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
15
Code:
//3,4=gps 
//9,5=gsm
//6,7=us
//9,10,11,12,13=rfid
//rx,tx=esp

//Changes should be done based on the output of previous program

#include "SPI.h"
#include "MFRC522.h"

#define SS_PIN 10
#define RST_PIN 9
#define SP_PIN 8

MFRC522 rfid(SS_PIN, RST_PIN);

MFRC522::MIFARE_Key key;

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <WiFi.h>

char ssid[] = "redmi";      // your network SSID (name)
char pass[] = "paramesh33";
int keyIndex = 0;           // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

WiFiServer server(80);
static const int RXPin = 4, TXPin = 3;//gps
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);//gps
SoftwareSerial mySerial(9, 5);//gsm

const int pingPin = 7;
const int echoPin = 6;//ultrasonic sensor
//double rfid;
float lat1,lon1,lat2,lon2,lat3,lon3,lat4,lon4,lat5,lon5,amount;
int rvalue=0,uvalue=0,t1=0,t2=0,t3=0,t4=0,t5=0,km=10;
void setup()
{
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  ss.begin(GPSBaud);
  mySerial.begin(9600);

   while (!Serial)
   {
    ; // wait for serial port to connect. Needed for native USB port only
   }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD)
  {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv != "1.1.0")
  {
    Serial.println("Please upgrade the firmware");
  }

  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED)
  {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(1000);
  }
  server.begin();
  // you're connected now, so print out the status:
  Serial.print("You're connected to the network");
}


void loop()
{
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial())
    return;

  // Serial.print(F("PICC type: "));
  MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
  // Serial.println(rfid.PICC_GetTypeName(piccType));

  // Check is the PICC of Classic MIFARE type
  if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
    piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
    piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
    Serial.println(F("Your tag is not of type MIFARE Classic."));
    return;
  }

  String strID = "";
  for (byte i = 0; i < 4; i++) {
    strID +=
    (rfid.uid.uidByte[i] < 0x10 ? "0" : "") +
    String(rfid.uid.uidByte[i], HEX) +
    (i!=3 ? ":" : "");
  }
  strID.toUpperCase();

  Serial.print("Tap card key: ");
  Serial.println(strID);
  if (strID.indexOf("E9:A3:DD:2B") >= 0)//1
  {
    t1=t1+1;
    rvalue = rvalue+1;
    if(t1%2==1)
    {
      Serial.print("parameshwari entered");
      while (ss.available() > 0)
      {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat1=gps.location.lat();
      Serial.print(lat1, 6);
      Serial.print(" Longitude= "); 
      lon1=gps.location.lng();
      Serial.println(lon1,6);
    }
  }
    }
    if(t1%2==0)
    {
      Serial.print("parameshwari is leaving");
      while (ss.available() > 0)
      {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat2=gps.location.lat();
      Serial.println(lat2, 6);
      Serial.print(" Longitude= "); 
      lon2=gps.location.lng();
      Serial.println(lon2,6);
      long distance = sqrt((lat1 - lat2) * (lat1 - lat2) + (lon1 - lon2) * (lon1 - lon2));
      mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
      mySerial.println("AT+CMGS="+917397170927"\r"); // Replace x with mobile number
      mySerial.println("you travelled");// The SMS text you want to send
      mySerial.println(distance);
      mySerial.println("kilometers.");
      amount=km*distance;
      mySerial.println(amount);
      mySerial.println("is reduced from your account");
      mySerial.println((char)26);// ASCII code of CTRL+Z
    }
    }
    }
    }//1

    if (strID.indexOf("38:86:8D:33") >= 0)//2
  {
    t1=t1+1;
    rvalue = rvalue+1;
    if(t1%2==1)
    {
      Serial.print("priya entered");
      while (ss.available() > 0)
      {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat1=gps.location.lat();
      Serial.print(lat1, 6);
      Serial.print(" Longitude= "); 
      lon1=gps.location.lng();
      Serial.println(lon1,6);
    }
  }
    }
    if(t1%2==0)
    {
      Serial.print("priya is leaving");
       while (ss.available() > 0)
       {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat2=gps.location.lat();
      Serial.print(lat2, 6);
      Serial.print(" Longitude= "); 
      lon2=gps.location.lng();
      Serial.println(lon2,6);
      long distance = sqrt((lat1 - lat2) * (lat1 - lat2) + (lon1 - lon2) * (lon1 - lon2));
      mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
      mySerial.println("AT+CMGS="+917397170927"\r"); // Replace x with mobile number
      mySerial.println("you travelled");// The SMS text you want to send
      mySerial.println(distance);
      mySerial.println("kilometers.");
      amount=km*distance;
      mySerial.println(amount);
      mySerial.println("is reduced from your account");
      mySerial.println((char)26);// ASCII code of CTRL+Z
    }
    }
    }
    }//2

    if (strID.indexOf("E4:0A:BA:EB") >= 0)//3
  {
    t1=t1+1;
    rvalue = rvalue+1;
    if(t1%2==1)
    {
      Serial.print("preethi entered");
      while (ss.available() > 0)
      {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat1=gps.location.lat();
      Serial.print(lat1, 6);
      Serial.print(" Longitude= "); 
      lon1=gps.location.lng();
      Serial.println(lon1,6);
    }
  }
    }
    if(t1%2==0)
    {
      Serial.print("preethi is leaving");
       while (ss.available() > 0)
       {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat2=gps.location.lat();
      Serial.print(lat2, 6);
      Serial.print(" Longitude= "); 
      lon2=gps.location.lng();
      Serial.println(lon2,6);
      long distance = sqrt((lat1 - lat2) * (lat1 - lat2) + (lon1 - lon2) * (lon1 - lon2));
      mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
      mySerial.println("AT+CMGS="+917397170927"\r"); // Replace x with mobile number
      mySerial.println("you travelled");// The SMS text you want to send
      mySerial.println(distance);
      mySerial.println("kilometers.");
      amount=km*distance;
      mySerial.println(amount);
      mySerial.println("is reduced from your account");
      mySerial.println((char)26);// ASCII code of CTRL+Z
      }
    }
    }
    }//3

    if (strID.indexOf("E4:0A:BA:EB") >= 0)//4
    {
    t1=t1+1;
    rvalue = rvalue+1;
    if(t1%2==1)
    {
      Serial.print("pradhiksha entered");
      while (ss.available() > 0)
      {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat1=gps.location.lat();
      Serial.print(lat1, 6);
      Serial.print(" Longitude= "); 
      lon1=gps.location.lng();
      Serial.println(lon1,6);
    }
  }
    }
    if(t1%2==0)
    {
      Serial.print("pradhiksha is leaving");
       while (ss.available() > 0)
       {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat2=gps.location.lat();
      Serial.print(lat2, 6);
      Serial.print(" Longitude= "); 
      lon2=gps.location.lng();
      Serial.println(lon2,6);
      long distance = sqrt((lat1 - lat2) * (lat1 - lat2) + (lon1 - lon2) * (lon1 - lon2));
      mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
      mySerial.println("AT+CMGS="+917397170927"\r"); // Replace x with mobile number
      mySerial.println("you travelled");// The SMS text you want to send
      mySerial.println(distance);
      mySerial.println("kilometers.");
      amount=km*distance;
      mySerial.println(amount);
      mySerial.println("is reduced from your account");
      mySerial.println((char)26);// ASCII code of CTRL+Z
    }
    }
    }
    }//4

    if (strID.indexOf("E4:0A:BA:EB") >= 0)//5
  {
    t1=t1+1;
    rvalue = rvalue+1;
    if(t1%2==1)
    {
      Serial.print("rashmitha entered");
      while (ss.available() > 0)
      {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat1=gps.location.lat();
      Serial.print(lat1, 6);
      Serial.print(" Longitude= "); 
      lon1=gps.location.lng();
      Serial.println(lon1,6);
    }
  }
    }
    if(t1%2==0)
    {
      Serial.print("rashmitha is leaving");
       while (ss.available() > 0)
       {
      gps.encode(ss.read());
      if (gps.location.isUpdated())
      {
      Serial.print("Latitude= "); 
      lat2=gps.location.lat();
      Serial.print(lat2, 6);
      Serial.print(" Longitude= "); 
      lon2=gps.location.lng();
      Serial.println(lon2,6);
      long distance = sqrt((lat1 - lat2) * (lat1 - lat2) + (lon1 - lon2) * (lon1 - lon2));
      mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
      mySerial.println("AT+CMGS="+917397170927"\r"); // Replace x with mobile number
      mySerial.println("you travelled");// The SMS text you want to send
      mySerial.println(distance);
      mySerial.println("kilometers.");
      amount=km*distance;
      mySerial.println(amount);
      mySerial.println("is reduced from your account");
      mySerial.println((char)26);// ASCII code of CTRL+Z
    }
    }
    }
    }//5

    
  }
  long duration, inches, cm;
   pinMode(pingPin, OUTPUT);
   digitalWrite(pingPin, LOW);
   delayMicroseconds(2);
   digitalWrite(pingPin, HIGH);
   delayMicroseconds(10);
   digitalWrite(pingPin, LOW);
   pinMode(echoPin, INPUT);
   duration = pulseIn(echoPin, HIGH);
   cm = microsecondsToCentimeters(duration);
   Serial.print(cm);
   Serial.print("cm");
   if(cm<20)
   {
    uvalue=uvalue+1;
   }
   if(uvalue!=rvalue)
   {
    Serial.begin("someone entered illegally");
   }
}
long microsecondsToCentimeters(long microseconds)
{
   return microseconds / 29 / 2;
}

this is my code, while compiling i am getting error but i don't know what's wrong in that
 
Last edited by a moderator:

What is this program, what language is it in, what compiler, what target and most importantly, what line does the error report as?

Normally constructor errors occur when C++ is being used but your code looks more like standard 'C'.

Brian.
 

The error "constructor" and "destructor" suggest C++ is being used but as far as I'm aware Arduino can't do that.

Regardless, I can't spot anything C++ related in the code and a quick glance reveals most of it is repeated blocks with different names which appear to be selected by different RFID identifiers. I don't see any obvious errors so it would be useful to know which line upsets the compiler.

Brian.
 

this is my code, while compiling i am getting error but i don't know what's wrong in that
In general, not to say always, compiler gives the line on the code where the error lies.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top