Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Start streaming on Wednesday!Stream Hackster Holidays, Ep. 4 on Wednesday!
Ashraf Nabil
Published

Track and Control Your Car Remotely

Using Arduino and Android

Full instructions provided51,246
Track and Control Your Car Remotely

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
1Sheeld
1Sheeld
×1
Relay (generic)
1x Relay (12V- 40A) OR 4x Relays (10A).
×1
Battery
×1
Car Fuse
×1
Wire
×1
Android device
Android device
×1

Story

Read more

Code

code.txt

C/C++
#include <OneSheeld.h>
char* gps = "gps";
char* stopp = "stop";
float lat ;                           
float lon ;
int lock = 12;
char charlat [12];
char charlon [12];
char readings [80];
boolean flag1 = false;
boolean flag2 = false;
boolean flag3 = false;
void setup()
{
  OneSheeld.begin();
  pinMode(lock,OUTPUT);
}
void loop() {  
  if(abs(AccelerometerSensor.getY()) > 1.5 )
  {
    if(!flag1)
    {   
      SMS.send("01004078579","The car is moving !!");
      flag1 = true;  
    }
  }
   if(!strcmp(SMS.getSms(),stopp)) 
  {
    if(!flag2)  
    {
      digitalWrite(lock,HIGH);
      flag2 = true;
    }
  }
  if(!strcmp(SMS.getSms(),gps)) 
  {
    if(!flag3)  
    {
      lat = GPS.getLatitude(); 
      lon = GPS.getLongitude(); 
      dtostrf(lat, 11, 7, charlat); 
      dtostrf(lon, 11, 7, charlon); 
      strcat(readings,"latitude is : ");   
      strcat (readings,charlat);  
      strcat(readings,"\nLongitude is : "); 
      strcat (readings,charlon);
      SMS.send("01004078579",readings);                             
      flag3 = true;
    }                                        
  } 
}

Credits

Ashraf Nabil

Ashraf Nabil

8 projects • 103 followers

Comments