GPS arduino GG map định vị người yêu

trả là e nghịch thêm về arduino và đang làm 1 con định vị gps để lắp cho xe máy.
phần cứng của e gồm arduino,module m6 xác định GPS( kinh độ vĩ độ),module sim 900a. giống kiểu đọc sim có thể gọi và nt đc

sau 1 thời gian khá dài cũng làm đc gần nưả công đoạn là nó đã trả tn gg map về cho đt

e gặp 1 số rắc rối là sau khi chạy code nó cứ lặp mãi,nghĩa là cứ gửi cái link gg map về máy e.
e biết là do hàm sendsms và hàm xác định GPS của e để trong vòng loop của arduino nên sẽ lắp.e thử cho cả 2 ra ngoài vào trong vòng setup thì nó ko chạy.:((
bác nào giúp e vs

tiện thế bác nào giỏi về lệnh at có thể giúp e khoản nữa là tạo password cho project này nghĩa là nhắn tin password đến sim 900a thì nó mới trả về link gg map .e cảm ơn.

đây là code của e tiện thể ai đam mê arduino
Nhân tiện bác nào mê arduino liên lạc giao lưu vs e học cơ khi bkhn https://www.facebook.com/lam.lon.1

        #include <SoftwareSerial.h>
         #include <TinyGPS.h>
      TinyGPS gps;
       SoftwareSerial serialgps (4,5);//mo cong giao tiep GPS 

        int year;
      byte month,day,hour,minute,second,hundredths;
     unsigned long chars;
     unsigned short sentences, failed_checksum;
     static float latitude,longitude;
     static void print_date(TinyGPS &gps);


    void setup()
  {
   Serial.begin(9600);
   serialgps.begin(9600);
   delay (5000);

      }
   // put your setup code here, to run once:

     void loop() 
       {
    while (serialgps.available()>0)
           {

      char c = serialgps.read();

 
         if (gps.encode(c))
       {
    
  gps.f_get_position(&latitude, &longitude);
  Serial.print("Lat/Long: ");
  Serial.print(latitude, 5);
  Serial.print(", ");
  Serial.println(longitude, 5);

 
   gps.stats(&chars, &sentences, &failed_checksum);
     delay (5000);

   SendSMS(latitude,longitude);
    } 
       }
    }
       void SendSMS(float latitude,float longitude  )
       {
     delay (1000);
     Serial.print("AT\r");
      delay(1000);
   char inchar= (char)Serial.read();
 
    Serial.println();
    Serial.println("AT+CMGF=1\r"); // sets the SMS mode to text
   delay(100);
    delay(1200);


    Serial.print("AT+CMGS=\""); // send the SMS number
    Serial.print("01682740718");
     Serial.println("\"");
      delay(1000);
       Serial.print("Location:"); // noi dung SMS

       Serial.print("www.google.com.vn/maps/place/");

        Serial.print(latitude, 5);

       Serial.print(",");

       Serial.print(longitude, 5);

     Serial.print("\r");

      delay(500);

     Serial.println((char)26);//o código ASCII do ctrl + z é 26

      delay(500);

     Serial.write(0x1A);
     Serial.write(0x0D);
    Serial.write(0x0A);

}

3 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?