Gps tracking system by sms

#include <Adafruit_Circuit_Playground.h>

/* #include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>*/

#include <Adafruit_FONA.h>
#include <LowPower.h>
#include <SoftwareSerial.h>
#define FONA_RX 11;
#define FONA_TX 10;
#define FONA_RST 4S;
SoftwareSerial fonaSS = SoftwareSerial
(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
const int MOSFET = 13;
const int WakeUp = 2;
char replybuffer[255];
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
float latitude, longitude, speed_kph, heading, speed_mph, altitude;
unsigned long currentMillis;
unsigned long previousMillis = 0;
unsigned long timer;
unsigned long timer2 = 0;
boolean gps_success;

void setup() {
Serial.begin(115200);
pinMode(WakeUp, INPUT);
pinMode(MOSFET, OUTPUT);
attachInterrupt(0, TimerReset, RISING);
digitalWrite(MOSFET, LOW);
delay(10000);
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void loop() {
while ( timer < 4200000){
if ( timer2 == 0 ){
GetGPS();
WriteSMS();
}
currentMillis = millis();
timer = timer + (currentMillis - previousMillis);
timer2 = timer2 + (currentMillis - previousMillis);
previousMillis = currentMillis;
if ( timer2 > 1800000){
GetGPS();
WriteSMS();
timer2 = 1;
}
}
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void WriteSMS () {
fonaSS.print("AT+CMGF=1\r");
delay(1000);
fonaSS.print("AT+CMGS="+0211977188"\r");
delay(1000);
fonaSS.println(latitude, 6);
fonaSS.println(longitude, 6);
fonaSS.print("\r");
delay(1000);
fonaSS.println((char)26);
fonaSS.println();
delay(10000);
digitalWrite(MOSFET, LOW);
}

void GetGPS() {
gps_success = 0;
digitalWrite(MOSFET, HIGH);
fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
while (1);
}
fona.enableGPS(true);
while(!gps_success){
delay(2000);
gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);
if (gps_success) {
Serial.print("GPS lat:");
Serial.println(latitude, 6);
Serial.print("GPS long:");
Serial.println(longitude, 6);
}}
}

void TimerReset() {
timer = 0;
}

Do you have a question ?
 
 
The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

yes, Arduino ide says that there is expected primary-expression before '(' token
for this line of code softwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);

#define FONA_RX 11;
#define FONA_TX 10;
#define FONA_RST 4S;

Delete the semicolons. Otherwise FONA+RX will be replaced by 11; throughout the code rather than 11 and cause problems

I have fixed all problems now, however, it now says there is an error compiling for board arduino uno

In that case you have not fixed all of the problems

Post your revised code (using code tags) and the full error message copied from the IDE using the "Copy Error messages" button

Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp: In member function 'void Adafruit_CircuitPlayground::playTone(uint16_t, uint16_t, bool)':

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:215:3: error: 'PLLFRQ' was not declared in this scope

PLLFRQ = (PLLFRQ & 0xCF) | 0x30; // Route PLL to async clk

^~~~~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:215:3: note: suggested alternative: 'PCIFR'

PLLFRQ = (PLLFRQ & 0xCF) | 0x30; // Route PLL to async clk

^~~~~~

PCIFR

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:216:3: error: 'TCCR4A' was not declared in this scope

TCCR4A = _BV(COM4A0) | _BV(PWM4A); // Clear on match, PWMA on

^~~~~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:216:3: note: suggested alternative: 'TCCR0A'

TCCR4A = _BV(COM4A0) | _BV(PWM4A); // Clear on match, PWMA on

^~~~~~

TCCR0A

In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,

             from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,

             from C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground/Adafruit_Circuit_Playground.h:20,

             from C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:30:

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:216:17: error: 'COM4A0' was not declared in this scope

TCCR4A = _BV(COM4A0) | _BV(PWM4A); // Clear on match, PWMA on

             ^

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:216:17: note: suggested alternative: 'COM0A0'

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:216:31: error: 'PWM4A' was not declared in this scope

TCCR4A = _BV(COM4A0) | _BV(PWM4A); // Clear on match, PWMA on

                           ^

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:216:31: note: suggested alternative: 'PWM'

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:217:3: error: 'TCCR4B' was not declared in this scope

TCCR4B = _BV(PWM4X) | scalebits; // PWM invert

^~~~~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:217:3: note: suggested alternative: 'TCCR0B'

TCCR4B = _BV(PWM4X) | scalebits; // PWM invert

^~~~~~

TCCR0B

In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,

             from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,

             from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,

             from C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground/Adafruit_Circuit_Playground.h:20,

             from C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:30:

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:217:17: error: 'PWM4X' was not declared in this scope

TCCR4B = _BV(PWM4X) | scalebits; // PWM invert

             ^

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:217:17: note: suggested alternative: 'PWM'

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:218:3: error: 'TCCR4D' was not declared in this scope

TCCR4D = 0; // Fast PWM mode

^~~~~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:218:3: note: suggested alternative: 'TCCR0A'

TCCR4D = 0; // Fast PWM mode

^~~~~~

TCCR0A

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:219:3: error: 'TCCR4E' was not declared in this scope

TCCR4E = 0; // Not enhanced mode

^~~~~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:219:3: note: suggested alternative: 'TCCR0A'

TCCR4E = 0; // Not enhanced mode

^~~~~~

TCCR0A

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:220:3: error: 'DT4' was not declared in this scope

DT4 = 0; // No dead time

^~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:220:3: note: suggested alternative: 'DD4'

DT4 = 0; // No dead time

^~~

DD4

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:226:3: error: 'TC4H' was not declared in this scope

TC4H = hi1;

^~~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:226:3: note: suggested alternative: 'PC4'

TC4H = hi1;

^~~~

PC4

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:227:3: error: 'OCR4C' was not declared in this scope

OCR4C = lo1; // TOP

^~~~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:227:3: note: suggested alternative: 'OCR2A'

OCR4C = lo1; // TOP

^~~~~

OCR2A

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:229:3: error: 'OCR4A' was not declared in this scope

OCR4A = lo2; // 50% duty

^~~~~

C:\Program Files (x86)\Arduino\libraries\Adafruit_Circuit_Playground\Adafruit_CircuitPlayground.cpp:229:3: note: suggested alternative: 'OCR2A'

OCR4A = lo2; // 50% duty

^~~~~

OCR2A

Multiple libraries were found for "Adafruit_FONA.h"

Used: C:\Users\lucia\OneDrive\Documents\Arduino\libraries\Adafruit_FONA-master

Not used: C:\Users\lucia\OneDrive\Documents\Arduino\libraries\Adafruit_FONA_Library

exit status 1

Error compiling for board Arduino Nano.

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

#include <Adafruit_Circuit_Playground.h>

/* #include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>*/

#include <Adafruit_FONA.h>
#include <LowPower.h>
#include <SoftwareSerial.h>
#define FONA_RX 11
#define FONA_TX 10
#define FONA_RST 4
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
const int MOSFET = 13;
const int WakeUp = 2;
char replybuffer[255];
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
float latitude, longitude, speed_kph, heading, speed_mph, altitude;
unsigned long currentMillis;
unsigned long previousMillis = 0;
unsigned long timer;
unsigned long timer2 = 0;
boolean gps_success;

void setup() {
Serial.begin(115200);
pinMode(WakeUp, INPUT);
pinMode(MOSFET, OUTPUT);
attachInterrupt(0, TimerReset, RISING);
digitalWrite(MOSFET, LOW);
delay(10000);
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void loop() {
while ( timer < 4200000){
if ( timer2 == 0 ){
GetGPS();
WriteSMS();
}
currentMillis = millis();
timer = timer + (currentMillis - previousMillis);
timer2 = timer2 + (currentMillis - previousMillis);
previousMillis = currentMillis;
if ( timer2 > 1800000){
GetGPS();
WriteSMS();
timer2 = 1;
}
}
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void WriteSMS () {
fonaSS.print("AT+CMGF=1\r");
delay(1000);
fonaSS.print("AT+CMGS="+0211977188"\r");
delay(1000);
fonaSS.println(latitude, 6);
fonaSS.println(longitude, 6);
fonaSS.print("\r");
delay(1000);
fonaSS.println((char)26);
fonaSS.println();
delay(10000);
digitalWrite(MOSFET, LOW);
}

void GetGPS() {
gps_success = 0;
digitalWrite(MOSFET, HIGH);
fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
while (1);
}
fona.enableGPS(true);
while(!gps_success){
delay(2000);
gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);
if (gps_success) {
Serial.print("GPS lat:");
Serial.println(latitude, 6);
Serial.print("GPS long:");
Serial.println(longitude, 6);
}}
}

void TimerReset() {
timer = 0;
}

No more help from me until you post your code in code tags as requested

<#include <Adafruit_Circuit_Playground.h>

/* #include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>*/

#include <Adafruit_FONA.h>
#include <LowPower.h>
#include <SoftwareSerial.h>
#define FONA_RX 11
#define FONA_TX 10
#define FONA_RST 4
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
const int MOSFET = 13;
const int WakeUp = 2;
char replybuffer[255];
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
float latitude, longitude, speed_kph, heading, speed_mph, altitude;
unsigned long currentMillis;
unsigned long previousMillis = 0;
unsigned long timer;
unsigned long timer2 = 0;
boolean gps_success;

void setup() {
Serial.begin(115200);
pinMode(WakeUp, INPUT);
pinMode(MOSFET, OUTPUT);
attachInterrupt(0, TimerReset, RISING);
digitalWrite(MOSFET, LOW);
delay(10000);
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void loop() {
while ( timer < 4200000){
if ( timer2 == 0 ){
GetGPS();
WriteSMS();
}
currentMillis = millis();
timer = timer + (currentMillis - previousMillis);
timer2 = timer2 + (currentMillis - previousMillis);
previousMillis = currentMillis;
if ( timer2 > 1800000){
GetGPS();
WriteSMS();
timer2 = 1;
}
}
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void WriteSMS () {
fonaSS.print("AT+CMGF=1\r");
delay(1000);
fonaSS.print("AT+CMGS="+0211977188"\r");
delay(1000);
fonaSS.println(latitude, 6);
fonaSS.println(longitude, 6);
fonaSS.print("\r");
delay(1000);
fonaSS.println((char)26);
fonaSS.println();
delay(10000);
digitalWrite(MOSFET, LOW);
}

void GetGPS() {
gps_success = 0;
digitalWrite(MOSFET, HIGH);
fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
while (1);
}
fona.enableGPS(true);
while(!gps_success){
delay(2000);
gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);
if (gps_success) {
Serial.print("GPS lat:");
Serial.println(latitude, 6);
Serial.print("GPS long:");
Serial.println(longitude, 6);
}}
}

void TimerReset() {
timer = 0;
}>

Still wrong

Here, let me do it for you

< #include <Adafruit_Circuit_Playground.h>

/* #include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>*/

#include <Adafruit_FONA.h>
#include <LowPower.h>
#include <SoftwareSerial.h>
#define FONA_RX 11
#define FONA_TX 10
#define FONA_RST 4
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
const int MOSFET = 13;
const int WakeUp = 2;
char replybuffer[255];
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
float latitude, longitude, speed_kph, heading, speed_mph, altitude;
unsigned long currentMillis;
unsigned long previousMillis = 0;
unsigned long timer;
unsigned long timer2 = 0;
boolean gps_success;

void setup()
{
  Serial.begin(115200);
  pinMode(WakeUp, INPUT);
  pinMode(MOSFET, OUTPUT);
  attachInterrupt(0, TimerReset, RISING);
  digitalWrite(MOSFET, LOW);
  delay(10000);
  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void loop()
{
  while ( timer < 4200000)
  {
    if ( timer2 == 0 )
    {
      GetGPS();
      WriteSMS();
    }
    currentMillis = millis();
    timer = timer + (currentMillis - previousMillis);
    timer2 = timer2 + (currentMillis - previousMillis);
    previousMillis = currentMillis;
    if ( timer2 > 1800000)
    {
      GetGPS();
      WriteSMS();
      timer2 = 1;
    }
  }
  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void WriteSMS ()
{
  fonaSS.print("AT+CMGF=1\r");
  delay(1000);
  fonaSS.print("AT+CMGS=" + 0211977188"\r");
  delay(1000);
  fonaSS.println(latitude, 6);
  fonaSS.println(longitude, 6);
  fonaSS.print("\r");
  delay(1000);
  fonaSS.println((char)26);
  fonaSS.println();
  delay(10000);
  digitalWrite(MOSFET, LOW);
}

void GetGPS()
{
  gps_success = 0;
  digitalWrite(MOSFET, HIGH);
  fonaSerial->begin(4800);
  if (! fona.begin(*fonaSerial))
  {
    while (1);
  }
  fona.enableGPS(true);
  while (!gps_success)
  {
    delay(2000);
    gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);
    if (gps_success)
    {
      Serial.print("GPS lat:");
      Serial.println(latitude, 6);
      Serial.print("GPS long:");
      Serial.println(longitude, 6);
    }
  }
}

void TimerReset()
{
  timer = 0;
}

and to help further I have Auto formatted the code in the IDE to make it easier to read and understand

As to the problem, it is because you have the board set to Uno in the IDE

Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"

but the Circuit playground is not a Uno

Read this Set Up Arduino IDE | Adafruit Circuit Playground Express | Adafruit Learning System

So how do i change the circuit playground to an arduino?

fonaSS.print("AT+CMGS="+0211977188"\r");
also it says for this line of code that there is invalid digital in octal constant.

It is already an Arduino bit it uses a different processor than the Uno. You need to install support for it in the IDE following the instructions in the link that I posted

Once you do that then most of the errors will not happen and you can concentrate on any that are left

ok i have now fixed that but now its saying this
Arduino: 1.8.13 (Windows 10), Board: "Adafruit Circuit Playground Express"

F0BC3WXJ0CORE4L:11:10: fatal error: SoftwareSerial.h: No such file or directory

Multiple libraries were found for "Adafruit_FONA.h"

#include <SoftwareSerial.h>

Used: C:\Users\lucia\OneDrive\Documents\Arduino\libraries\Adafruit_FONA-master

      ^~~~~~~~~~~~~~~~~~

Not used: C:\Users\lucia\OneDrive\Documents\Arduino\libraries\Adafruit_FONA_Library

compilation terminated.

exit status 1

SoftwareSerial.h: No such file or directory

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

Arduino ide says my code is wrong and I don't know what to do. I am following the great Scotts youtube tutorial. I used the exact same code but it says it's wrong. Here is the code, if anyone could help me that would be much appreciated.

#include <Adafruit_Circuit_Playground.h>

 #include <Adafruit_Circuit_Playground.h>

/* #include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>*/

#include <Adafruit_FONA.h>
#include <LowPower.h>
#include <SoftwareSerial.h>
#define FONA_RX 11
#define FONA_TX 10
#define FONA_RST 4
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
const int MOSFET = 13;
const int WakeUp = 2;
char replybuffer[255];
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
float latitude, longitude, speed_kph, heading, speed_mph, altitude;
unsigned long currentMillis;
unsigned long previousMillis = 0;
unsigned long timer;
unsigned long timer2 = 0;
boolean gps_success;

void setup()
{
  Serial.begin(115200);
  pinMode(WakeUp, INPUT);
  pinMode(MOSFET, OUTPUT);
  attachInterrupt(0, TimerReset, RISING);
  digitalWrite(MOSFET, LOW);
  delay(10000);
  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void loop()
{
  while ( timer < 4200000)
  {
    if ( timer2 == 0 )
    {
      GetGPS();
      WriteSMS();
    }
    currentMillis = millis();
    timer = timer + (currentMillis - previousMillis);
    timer2 = timer2 + (currentMillis - previousMillis);
    previousMillis = currentMillis;
    if ( timer2 > 1800000)
    {
      GetGPS();
      WriteSMS();
      timer2 = 1;
    }
  }
  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void WriteSMS ()
{
  fonaSS.print("AT+CMGF=1\r");
  delay(1000);
  fonaSS.print("AT+CMGS="+64211977188"\does this work");
  delay(1000);
  fonaSS.println(latitude, 6);
  fonaSS.println(longitude, 6);
  fonaSS.print("\r");
  delay(1000);
  fonaSS.println((char)26);
  fonaSS.println();
  delay(10000);
  digitalWrite(MOSFET, LOW);
}

void GetGPS()
{
  gps_success = 0;
  digitalWrite(MOSFET, HIGH);
  fonaSerial->begin(4800);
  if (! fona.begin(*fonaSerial))
  {
    while (1);
  }
  fona.enableGPS(true);
  while (!gps_success)
  {
    delay(2000);
    gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);
    if (gps_success)
    {
      Serial.print("GPS lat:");
      Serial.println(latitude, 6);
      Serial.print("GPS long:");
      Serial.println(longitude, 6);
    }
  }
}

void TimerReset()
{
  timer = 0;
}`

Preformatted text`

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

Duplicate topics merged

Cross posting is against the rules of this forum. It wastes time so please do not do it

Sorry about that i just desperately need to fix this as soon as possible.

i put code tags now. Sorry to be pushy but i need this finished soon.

#include <Adafruit_Circuit_Playground.h>

 #include <Adafruit_Circuit_Playground.h>

/* #include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>*/

#include <Adafruit_FONA.h>
#include <LowPower.h>
#include <SoftwareSerial.h>
#define FONA_RX 11
#define FONA_TX 10
#define FONA_RST 4
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
const int MOSFET = 13;
const int WakeUp = 2;
char replybuffer[255];
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST);
float latitude, longitude, speed_kph, heading, speed_mph, altitude;
unsigned long currentMillis;
unsigned long previousMillis = 0;
unsigned long timer;
unsigned long timer2 = 0;
boolean gps_success;

void setup()
{
  Serial.begin(115200);
  pinMode(WakeUp, INPUT);
  pinMode(MOSFET, OUTPUT);
  attachInterrupt(0, TimerReset, RISING);
  digitalWrite(MOSFET, LOW);
  delay(10000);
  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void loop()
{
  while ( timer < 4200000)
  {
    if ( timer2 == 0 )
    {
      GetGPS();
      WriteSMS();
    }
    currentMillis = millis();
    timer = timer + (currentMillis - previousMillis);
    timer2 = timer2 + (currentMillis - previousMillis);
    previousMillis = currentMillis;
    if ( timer2 > 1800000)
    {
      GetGPS();
      WriteSMS();
      timer2 = 1;
    }
  }
  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void WriteSMS ()
{
  fonaSS.print("AT+CMGF=1\r");
  delay(1000);
  fonaSS.print("AT+CMGS="+64211977188"\does this work");
  delay(1000);
  fonaSS.println(latitude, 6);
  fonaSS.println(longitude, 6);
  fonaSS.print("\r");
  delay(1000);
  fonaSS.println((char)26);
  fonaSS.println();
  delay(10000);
  digitalWrite(MOSFET, LOW);
}

void GetGPS()
{
  gps_success = 0;
  digitalWrite(MOSFET, HIGH);
  fonaSerial->begin(4800);
  if (! fona.begin(*fonaSerial))
  {
    while (1);
  }
  fona.enableGPS(true);
  while (!gps_success)
  {
    delay(2000);
    gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);
    if (gps_success)
    {
      Serial.print("GPS lat:");
      Serial.println(latitude, 6);
      Serial.print("GPS long:");
      Serial.println(longitude, 6);
    }
  }
}

void TimerReset()
{
  timer = 0;
}