image of the Arduino GSM Shield on top of an Arduino Uno
image of the Arduino GSM Shield on top of an Arduino or Genuino board
Optional analog sensors like photoresistors, potentiometers and such may be connected, as explained elsewhere in our tutorials, to pins A0 - A5
The complete sketch is below.
Last revision 2015/08/13 by SM
Examples > Make Voice Call
This example shows how to use the GSM Shield and Library to make voice calls. Please click here for more information on the GSM library.
Examples > GSM library
This sketch turns the Arduino with a GSM shield and a data enabled SIM card into a web server. When the Arduino receives a request from a connected client, it sends back the value of analog inputs 0-5.
Not all network operators allow incoming data requests from outside their network. This means you can create a web server with the GSM shield, but you may not be able to connect to it from the public internet; only from another data enabled device from the same provider on the same network. You should check with your provider to see what specific policies they have in place regarding incoming data connections.
The code below is configured for use with a GSM/GPRS shield. In the variable declaration area, you need to instantiate both the
GSMVoiceCall classes. Inside
GSM.begin(), with the
PINNUMBER of your SIM card as parameter.
GSM.begin() will return whether the shield managed to connect to the GSM network or not.
loop(), the input from the Serial Monitor is used to tell the GSM Shield a phone number to call to. The code waits until the call is over before performing any other actions.