1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

GSM: Backported library from IDE 1.5.x

Fixes #2343
This commit is contained in:
Cristian Maglie
2014-10-09 23:47:46 +02:00
parent d63350b506
commit afc368b01f
23 changed files with 330 additions and 331 deletions

View File

@ -1,23 +1,23 @@
/*
GSM Scan Networks
This example prints out the IMEI number of the modem,
then checks to see if it's connected to a carrier. If so,
then checks to see if it's connected to a carrier. If so,
it prints the phone number associated with the card.
Then it scans for nearby networks and prints out their signal strengths.
Circuit:
* GSM shield
* GSM shield
* SIM card
Created 8 Mar 2012
by Tom Igoe, implemented by Javier Carazo
Modified 4 Feb 2013
by Scott Fitzgerald
http://arduino.cc/en/Tutorial/GSMToolsGsmScanNetworks
This example code is part of the public domain
*/
@ -48,15 +48,15 @@ void setup()
Serial.println("GSM networks scanner");
scannerNetworks.begin();
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
while (notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
if (gsmAccess.begin(PINNUMBER) == GSM_READY)
notConnected = false;
else
{
@ -64,13 +64,13 @@ void setup()
delay(1000);
}
}
// get modem parameters
// IMEI, modem unique identifier
Serial.print("Modem IMEI: ");
IMEI = modemTest.getIMEI();
IMEI.replace("\n","");
if(IMEI != NULL)
IMEI.replace("\n", "");
if (IMEI != NULL)
Serial.println(IMEI);
}
@ -79,11 +79,11 @@ void loop()
// scan for existing networks, displays a list of networks
Serial.println("Scanning available networks. May take some seconds.");
Serial.println(scannerNetworks.readNetworks());
// currently connected carrier
// currently connected carrier
Serial.print("Current carrier: ");
Serial.println(scannerNetworks.getCurrentCarrier());
// returns strength and ber
// signal strength in 0-31 scale. 31 means power > 51dBm
// BER is the Bit Error Rate. 0-7 scale. 99=not detectable