EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / can u plz tell me the meaning of the code below

can u plz tell me the meaning of the code below

|

Microcontroller › Arduino › Test process for arduino and gps module › can u plz tell me the meaning of the code below

January 21, 2016 at 5:58 am #13643
rupa
Participant
#include<LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7,11);
 
#define vibrate_sense 9
#define buzzer 12
 
char str[70];
char test[]="$GPGGA";      
char logitude[10];
char latitude[10];
 
int i,j,k;
int temp;
//int Ctrl+z=26;    //for sending msg
int led=13;
 
void setup()
{
  lcd.begin(16,2);
  Serial.begin(4800);
  pinMode(vibrate_sense, INPUT);
  pinMode(led, OUTPUT);
  pinMode(buzzer,OUTPUT);
  lcd.setCursor(0,0);
  lcd.print("GPS Besed Vehicle ");
  lcd.setCursor(0,1);
  lcd.print("Tracking System");
  delay(3000);
}
 
void loop()
{
  if (digitalRead(vibrate_sense) == HIGH)
  {
    for(i=18;i<27;i++)          //extract latitude from string
    {
      latitude[j]=str;
      j++;
    }
   
    for(i=30;i<40;i++)          //extract longitude from string
    {
      logitude[k]=str;
      k++;
    }
    digitalWrite(buzzer,HIGH);
    lcd.setCursor(0,0);        //display latitude and longitude on 16X2 lcd display 
    lcd.print("Lat(N)");
    lcd.print(latitude);
    lcd.setCursor(0,1);
    lcd.print("Lon(E)");
    lcd.print(logitude);
    delay(100);
    Serial.begin(9600);
    Serial.println("AT+CMGF=1");    //select text mode
    delay(10);
    Serial.println("AT+CMGS="8@@@@@@@@"");  // enter receipent number
    Serial.println("Vehicle Accident Happend at Place:");
    Serial.print("Latitude(N): ");             //enter latitude in msg
    Serial.println(latitude);                  //enter latitude value in msg
    Serial.print("Longitude(E): ");            //enter Longitude in Msg
    Serial.println(logitude);                  //enter longitude value in msg
    Serial.print("Help Please");
    Serial.write(26);                      //send msg  Ctrl+z=26
    temp=0;
    i=0;
    j=0;
    k=0;
    delay(20000);                        // next reading within 20 seconds
    Serial.begin(4800);
  }
  else
  {
   for(i=18;i<27;i++)          //extract latitude from string
    {
      latitude[j]=str;
      j++;
    }
   
    for(i=30;i<40;i++)          //extract longitude from string
    {
      logitude[k]=str;
      k++;
    }
   
    lcd.setCursor(0,0);        //display latitude and longitude on 16X2 lcd display 
    lcd.print("Lat(N)");
    lcd.print(latitude);
    lcd.setCursor(0,1);
    lcd.print("Lon(E)");
    lcd.print(logitude);
    delay(100);
    Serial.begin(9600);
    Serial.println("AT+CMGF=1");    //select text mode
    delay(10);
    Serial.println("AT+CMGS="8@@@@@@@@"");  // enter receipent number
    Serial.println("Vehicle location Place:");
    Serial.print("Latitude(N): ");             //enter latitude in msg
    Serial.println(latitude);                  //enter latitude value in msg
    Serial.print("Longitude(E): ");            //enter Longitude in Msg
    Serial.println(logitude);                  //enter longitude value in msg
    Serial.write(26);                      //send msg  Ctrl+z=26
    temp=0;
    i=0;
    j=0;
    k=0;
    delay(200000);                        // next reading within 20 seconds
    Serial.begin(4800); 
  }
}
 
void serialEvent()
{
  while (Serial.available())            //Serial incomming data from GPS
  {
    char inChar = (char)Serial.read();
     str= inChar;                    //store incomming data from GPS to temparary string str[]
     i++;
     if (i < 7)                      
     {
      if(str[i-1] != test[i-1])         //check for right string
      {
        i=0;
      }
     }
    if(i >=60)
    {
     break;
    }
  }
}

RSS Recent Posts

  • washing machine motor wiring June 15, 2026
  • effect of calibration on s-parameters June 15, 2026
  • Mitsubishi Electric IPM module lot code format - how to decode? June 14, 2026
  • Replacement IGBT for DGG4015 for Honda Motorcycle ECU June 14, 2026
  • TDK Lambda ESS 500-20-11-D-LB-RSTL Parallel Operation June 13, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise