Examples of usage A-GSM shield
To connect with cap-And-GSM-Shield was applied library available on the website www.github.com. It allows you to use features of the module.
In the example, we used the following elements:
- Arduino Uno
- The SIM card placed in the module
- Library GSM_GPRSLibrary
For module-GSM-Shield, insert SIM card, then put it on the Arduino. The next step is the connection, taken library for the environment Arduino (Sketch -> Include Library -> Add .ZIP Library)
Sending SMS messages
For SMS we use a very simple example:
#include "SIM900.h" #include#include "sms.h" SMSGSM sms; void setup() { Serial.begin(9600); if (gsm.begin(2400)) // inicjalizacja modułu { Serial.println("Wysyłanie..."); if (sms.SendSMS("+48111111111", "Przykładowy tekst")) // numer telefonu oraz treść wiadomości Serial.println("nWysyłanie wiadomości powiodło się"); } }; void loop() {};
The program is based on the example attached to the above-mentioned library. It can be used to send SMS to specified phone number (text message and the recipient's phone number, enter in the marked areas).
Connection
To connect we will use the following program:
#include "SIM900.h" #include#include "call.h" CallGSM call; void setup() { Serial.begin(9600); // gsm.begin(2400); // inicjalizacja modułu }; void loop() { if (call.CallStatus() != CALL_ACTIVE_VOICE) { Serial.println("Nawiązywanie połączenia"); call.Call("+48111111111"); // numer odbiorcy } delay(1000); };
The program establishes a connection with the selected phone number.