Exemplo n.º 1
0
// Begin
// Restart or start the modem
// May be synchronous
GSM3_NetworkStatus_t GSM3ShieldV1AccessProvider::begin(char* pin, bool restart, bool synchronous)
{	
	pinMode(__RESETPIN__, OUTPUT);

	#ifdef TTOPEN_V1
	pinMode(__POWERPIN__, OUTPUT);
	digitalWrite(__POWERPIN__, HIGH);
	#endif

	// If asked for modem restart, restart
	if (restart) 
		HWrestart();
	else 
 		HWstart();
  
	theGSM3ShieldV1ModemCore.gss.begin(9600);
	// Launch modem configuration commands
	ModemConfiguration(pin);
	// If synchronous, wait till ModemConfiguration is over
	if(synchronous)
	{
		// if we shorten this delay, the command fails
		while(ready()==0) 
			delay(1000); 
	}
	return getStatus();
}
Exemplo n.º 2
0
SIM800_NetworkStatus_t SIM808AccessProvider::begin(char* pin, bool restart, bool synchronous){
	pinMode(__RESETPIN__,OUTPUT);
	pinMode(13, OUTPUT);

	if (restart){
#if ANDYDEBUG
		Serial.println("restart...");//debug print
#endif
		HWrestart();
	}else{
		HWstart();
	}
	delay(200);
	//start timer and Serial1 int...
	SIM808ModemCore_t.gss.begin(19200);//100ms
	
	ModemConfiguration(pin);
	flags_st = 0;
	if (synchronous){
		while (ready() == 0){
			delay(1500);
			if (flags_st > 20){
				SIM808ModemCore_t.closeCommand(3);
				break;
			}
			flags_st++;
		}
	}
	return getStatus();
}