#include expects "FILENAME" or <FILENAME> error in this here

Ummm.... Hi guys im new to arduino and it hasnt been long since i started getting problems
ive got an error code that says
#include expects "FILENAME" or
my code

#include &lt;TinyGPS.h&gt;
#include &lt;SoftwareSerial.h&gt;
**#include &lt;Wire.h&gt;**//this one is giving error
SoftwareSerial Gsm(9, 10);
 
char phone_no[] = "+91xxxxxxxxxx";
 
TinyGPS gps;
int state;
String textMessage;
void setup() {
  Serial.begin(9600);
  Gsm.begin(9600);
  delay(2000);
  Serial.print("AT+CMGF=1\r");
  delay(100);
  Serial.print("AT+CNMI=2,2,0,0,0\r");
  delay(100);
  pinMode(5, INPUT);
}
 
void loop() {
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;
 
  for (unsigned long start = millis(); millis() - start &lt; 1000;) {
    while (Serial.available()) {
      char c = Serial.read();
      Serial.print(c);
      if (gps.encode(c))
        newData = true;
    }
  }
 
  if (textMessage.indexOf("LOCAL") &gt;= 0) {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&amp;flat, &amp;flon, &amp;age);
    Gsm.print("AT+CMGF=1\r");
    delay(400);
    Gsm.print("AT+CMGS=\"");
    Gsm.print(phone_no);
    Gsm.println("\"");
    delay(3000);
    Gsm.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(",");
    Gsm.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    delay(200);
    Gsm.println((char)26);
    delay(200);
    Gsm.println();
    delay(10000);
  }
 
  state = digitalRead(5);
 
  if (state == 0) {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&amp;flat, &amp;flon, &amp;age);
    Gsm.print("AT+CMGF=1\r");
    delay(400);
    Gsm.print("AT+CMGS=\"");
    Gsm.print(phone_no);
    Gsm.println("\"");
    delay(3000);
    Gsm.println("Alert I need help... ");
    //Prateek
    //www.justdoelectronics.com
    Gsm.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(",");
    Gsm.print(",");
    Gsm.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    delay(200);
    Gsm.println((char)26);
    delay(200);
    Gsm.println();
    Serial.print("Alert I need help... ");
    delay(10000);
 
  } else {
    delay(10);
  }
 
  Serial.println(failed);
  Serial.println("**GPS: check wiring **");
}

which editor did you use to produce the file? it has added it own formatting to the output file
for example, you should have <> around the filenames

#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include <Wire.h>

Probably copied from some crappy website :laughing:

1 Like

or used a wordprocessor which generated different quotation marks, e.g. openoffice writer
quotes
which when pasted into Arduino IDE gave the problems in post #1

Yeahh

.......

I copied from a stupid website

I tried using those brackets but it give error that 'It' was not defined without any scope.
In this line of the code-

Replace all &lt; by < and all &gt; by >.

I am using an arduino nano, sim800l gsm module and a neo 6vm gps tracker. I am making gps tracker with sms system for kids and women. One click button press and sms will go to provided number.
Link at yt Arduino Gps And Gsm Based location Tracking System | Women Safety Device With GPS Tracking - YouTube
And website link Gps & Gsm Location Tracking System Using Arduino
Please help me out this is an important project assignment for me from my college.
Thanks

You will also have to replace all &amp; by &.

What do you study? Or which subject is this for?

Robotics, and thanks ill try changing the code rn
:slightly_smiling_face:

1 Like
#include<TinyGPS.h>;
#include<SoftwareSerial.h>;
#include<Wire.h>
SoftwareSerial Gsm(9, 10);
 
char phone_no[] = "+91xxxxxxxxxx";
 
TinyGPS gps;
int state;
String textMessage;
void setup() {
  Serial.begin(9600);
  Gsm.begin(9600);
  delay(2000);
  Serial.print("AT+CMGF=1\r");
  delay(100);
  Serial.print("AT+CNMI=2,2,0,0,0\r");
  delay(100);
  pinMode(5, INPUT);
}
 
void loop() {
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;
 
  for (unsigned long start = millis(); millis() - start< 1000;) {
    while (Serial.available()) {
      char c = Serial.read();
      Serial.print(c);
      if (gps.encode(c))
        newData = true;
    }
  }
 
  if (textMessage.indexOf("LOCAL")>= 0) {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Gsm.print("AT+CMGF=1\r");
    delay(400);
    Gsm.print("AT+CMGS=\"");
    Gsm.print(phone_no);
    Gsm.println("\"");
    delay(3000);
    Gsm.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(",");
    Gsm.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    delay(200);
    Gsm.println((char)26);
    delay(200);
    Gsm.println();
    delay(10000);
  }
 
  state = digitalRead(5);
 
  if (state == 0) {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Gsm.print("AT+CMGF=1\r");
    delay(400);
    Gsm.print("AT+CMGS=\"");
    Gsm.print(phone_no);
    Gsm.println("\"");
    delay(3000);
    Gsm.println("Alert I need help... ");
    //Prateek
    //www.justdoelectronics.com
    Gsm.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(",");
    Gsm.print(",");
    Gsm.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    delay(200);
    Gsm.println((char)26);
    delay(200);
    Gsm.println();
    Serial.print("Alert I need help... ");
    delay(10000);
 
  } else {
    delay(10);
  }
 
  Serial.println(failed);
  Serial.println("**GPS: check wiring **");
}

This website https://justdoelectronics.com/gps-gsm-based-location-tracking-system-using-arduino/
is a disaster

1 Like

Hell yeah its a disaster.
BTW thanks guys.. :smiling_face_with_three_hearts:

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