Hello,
i'm trying to control the gsm tc35 only via my phone number.. (all other calls want to be rejected).
But the code below does not work.. Retrieve calling number example doesnot work either
Here is my code
#include <SoftwareSerial.h>
#include <String.h>
char inchar; // Will hold the incoming character from the Serial Port.
char data[20]="6938219287";
SoftwareSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
int numring=0;
int comring=2;
int onoff=0; // 0 = off, 1 = on
void setup()
{
pinMode(5, OUTPUT);// starts a fan
pinMode(13, OUTPUT); // LEDs - off = red, on = green
digitalWrite(5, LOW);
digitalWrite(13, LOW);
//Initialize serial port for communication.
cell.begin(9600);
delay(10);
Serial.begin(9600);
delay(10);
cell.println("AT+CLIP=1");
cell.println("\x1A");
//cell.println("ATE=0");
//delay(1000);
Serial.println("Ready to excecute your commands");
delay(100);
}
void doSomething()
{
if (onoff==0)
{
onoff=1;
digitalWrite(13, LOW);
digitalWrite(5, LOW);
}
else
if (onoff==1)
{
onoff=0;
digitalWrite(13, HIGH);
digitalWrite(5, HIGH);
}
}
void loop()
{
//If a character comes in from the cellular module...
while(cell.available() >0)
{
inchar=cell.read();
delay(10);
Serial.print(inchar);
if(strstr(data, "6938219287"))
numring++;
if (numring==comring)
{
numring=0; // reset ring counter
doSomething;
}break;
}
}
Any ideas??