okay we will look into this more. I was just confused as to why it was sending me commas instead of the string that I defined. Where does the float go? Does the float go under the loop or the setup? Another question...do I have to define what the gps_string is? Also the code that I presented to you was written from scratch but using the FONAtest code as a reference. I didn't mean to annoy you in any way...I am just trying to learn how to do this. This is a school project and our teacher knows some about arduino but not enough to help us with this project. The adafruit manual for the Fona 808 just shows you how to do things through the serial monitor, which I was able to make everything work via the serial monitor, but I wanted to get away from the serial monitor and use it standalone. This forum is the only thing I can rely on as far as this project goes.
Update...we got the thing to send us the string, but it doesn't include latitude and longitude. It sends us the date and time only. It sends it to us in this format
1,0,20190128213123.000,,,,0.00,0.0,0,,,,,,0,0,,,,,
Is there any way to get it to send coordinates with it? Here is the code that we have now...
- Code: Select all | TOGGLE FULL SIZE
#include "Adafruit_FONA.h"
#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4
#include <SoftwareSerial.h>
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
// constants won't change:
const int buttonPin = 5; // button for auto emergency distress
const int ledPin = 12; // LED for distress will be called
// variables will change:
int buttonState = 0; // start button HIGH
char gps_string[ 140 ];
void setup() {
fonaSerial->begin(4800);
fona.begin(*fonaSerial);
fona.enableGPS(true);
pinMode(ledPin, OUTPUT); // initialize the LED pin as an output
pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input
}
void loop() {
buttonState = digitalRead(buttonPin);
fona.getGPS( 0, gps_string, 140 );
if (buttonState == LOW) {
digitalWrite(ledPin, LOW);
fona.hangUp();}
else {
digitalWrite(ledPin, HIGH);
delay(5000);
fona.sendSMS("7247147099", gps_string );
delay(2500);
fona.callPhone("7247147099");
}
}