Ill send you my final code with your amendments, see if you can stop any mistakes that way,
if not then ill just try and do most of my report without the evidence and see how it goes.
#include <TinyGPS.h>
//This program is designed to send gps coordinates to a mobile phone via bluetooth,
//it should show some sort of indication when the gps sheild con not receive any coordinates
//and when the device travels outside a certain boundary.
#include <SoftwareSerial.h>// import the serial library
TinyGPS gps;
SoftwareSerial ss
(10, 11); // RX, TX
void setup() {
// this is the main code that will run once
Serial.begin(57600);
ss.begin(115200);
}
void loop()
{
// this is the main code that will run repeatedly
delay(5000);
if (Serial.available()){
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
unsigned endLoopTime = millis() + 1000; // Spend up to 1,000 ms in the loop
// newData previously set to false in your program
while ( (millis() < endLoopTime) && (!newData) )
{
if (ss.available())
{
char c = ss.read();
Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
//displays the coordinates
if (newData)
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("LAT=");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" LON=");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(" SAT=");
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(" PREC=");
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
// Sets the boundries
if (flat > 53.471623)
{
Serial.print("Lost Connection - High!");
}
else if (flat < 53.471555)
{
Serial.print("Lost Connection - Low!");
}
if (flon > -2.240617)
{
Serial.print("Lost Connection - Right!");
}
else if (flon < -2.241046)
{
Serial.print("Lost Connection - Left!");
}
}
//displays an error when the gpd shield can not receive the coordinates
gps.stats(&chars, &sentences, &failed);
Serial.print(" CHARS=");
Serial.print(chars);
Serial.print(" SENTENCES=");
Serial.print(sentences);
Serial.print(" CSUM ERR=");
Serial.println(failed);
if (chars == 0)
Serial.println("** No satellites connected **");
}
}
but i really appreciate your help, thank you.