Hazieqbento
Newbie
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;
}
}
}
[code tags added by moderator]
Last edited by a moderator: