Hey everyone
iv been having problems programming since im a newbie and after many searches and dead ends iv been told this is the right place to ask
i wanted to make a simple code to switch on a relay on if the calling number is only my number and if i called again it switches it off so i tried to compare the (numtell) array with a my number but it doesn't work
// Include the GSM library
#include <GSM.h>
// PIN Number
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess;
GSMVoiceCall vcs;
// Array to hold the number for the incoming call
char numtel[20];
pinMode(4, OUTPUT);
digitalWrite(4, LOW);
void setup()
{
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Receive Voice Call");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
// This makes sure the modem correctly reports incoming events
vcs.hangCall();
Serial.println("Waiting for a call");
}
void loop()
{
// Check the status of the voice call
switch (vcs.getvoiceCallStatus())
{
case IDLE_CALL: // Nothing is happening
break;
case RECEIVINGCALL: // Yes! Someone is calling us
Serial.println("RECEIVING CALL");
// Retrieve the calling number
vcs.retrieveCallingNumber(numtel, 20);
if( numtel == +11111111111 ;){
digitalWrite(4, HIGH);
\and the rest of the things i want to be done
// Print the calling number
Serial.print("Number:");
Serial.println(numtel);
// Answer the call, establish the call
vcs.answerCall();
break;
case TALKING: // In this case the call would be established
Serial.println("TALKING. Press enter to hang up.");
while(Serial.read()!='\n')
delay(100);
vcs.hangCall();
Serial.println("Hanging up and waiting for the next call.");
break;
}
delay(1000);
}
and some other few questions (other than the main question up there):
1 -how can i make a delay without stopping the arduino (with a small example please)
2 -i notice there is a command called (Break;) what does it mean and how can i use it
and im sorry if im asking too silly questions or asking alot
and thanks in advance