#define vibrate_sense 7 char char char char
str[70]; *test="$GPGGA"; logitude[10]; latitude[10];
int i,j,k; int temp; //int Ctrl+z=26; int led=13; void setup() { Serial.begin(9600); pinMode(vibrate_sense, INPUT); pinMode(led, OUTPUT); delay(3000); } void loop() { if (digitalRead(vibrate_sense)==0) { for(i=18;i<27;i++) { latitude[j]=str[i]; j++; } for(i=30;i<40;i++) { logitude[k]=str[i]; k++; } Serial.begin(9600); Serial.println("AT+CMGF=1"); delay(10); Serial.println("AT+CMGS=\"+918973435786\""); Serial.println("Vehicle Accident Happend at Place:"); Serial.print("Latitude(N):10.93912 "); Serial.println(latitude); Serial.print("Longitude(E):76.96154 "); Serial.println(logitude); Serial.print("Help Please"); Serial.write(26); temp=0; i=0; j=0; k=0; delay(20000); Serial.begin(9600); }
} void serialEvent() { while (Serial.available()) { char inChar = (char)Serial.read(); str[i]= inChar; i++; if (i < 9) { if(str[i-1] != test[i-1]) { i=0; } } if(i >=60) { break; } } }