diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-04-03 13:51:04 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-04-03 13:51:04 +0200 |
commit | ee90e68e86dd61d86f5d17b69080338328765b22 (patch) | |
tree | e620c0edc2690ab789b665e567910640597aa6fe /libraries/GSM/examples/Tools/TestModem | |
parent | 0ecdc5ebc96ad4c7c548c438a03d9ce00679db8b (diff) | |
parent | f50c307be280dc6ece9e70c43b301c1db36291a0 (diff) |
Merged 1.0.5
Merge remote-tracking branch 'arduino/master' into ide-1.5.x
Conflicts:
app/src/processing/app/Base.java
build/shared/revisions.txt
hardware/arduino/avr/cores/arduino/malloc.c
hardware/arduino/cores/arduino/avr-libc/malloc.c
hardware/arduino/cores/arduino/malloc.c
todo.txt
Diffstat (limited to 'libraries/GSM/examples/Tools/TestModem')
-rw-r--r-- | libraries/GSM/examples/Tools/TestModem/TestModem.ino | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/libraries/GSM/examples/Tools/TestModem/TestModem.ino b/libraries/GSM/examples/Tools/TestModem/TestModem.ino new file mode 100644 index 0000000..de61fff --- /dev/null +++ b/libraries/GSM/examples/Tools/TestModem/TestModem.ino @@ -0,0 +1,77 @@ +/* + + This example tests to see if the modem of the + GSM shield is working correctly. You do not need + a SIM card for this example. + + Circuit: + * GSM shield attached + + Created 12 Jun 2012 + by David del Peral + modified 21 Nov 2012 + by Tom Igoe + + http://arduino.cc/en/Tutorial/GSMToolsTestModem + + This sample code is part of the public domain + + */ + +// libraries +#include <GSM.h> + +// modem verification object +GSMModem modem; + +// IMEI variable +String IMEI = ""; + +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 + } + + // start modem test (reset and check response) + Serial.print("Starting modem test..."); + if(modem.begin()) + Serial.println("modem.begin() succeeded"); + else + Serial.println("ERROR, no modem answer."); +} + +void loop() +{ + // get modem IMEI + Serial.print("Checking IMEI..."); + IMEI = modem.getIMEI(); + + // check IMEI response + if(IMEI != NULL) + { + // show IMEI in serial monitor + Serial.println("Modem's IMEI: " + IMEI); + // reset modem to check booting: + Serial.print("Resetting modem..."); + modem.begin(); + // get and check IMEI one more time + if(modem.getIMEI() != NULL) + { + Serial.println("Modem is functoning properly"); + } + else + { + Serial.println("Error: getIMEI() failed after modem.begin()"); + } + } + else + { + Serial.println("Error: Could not get IMEI"); + } + // do nothing: + while(true); +} + |