|
| 1 | +/* |
| 2 | + * This example shows how to send an SMS message using the Arduino_Cellular library. |
| 3 | + * |
| 4 | + * Instructions: |
| 5 | + * 1. Insert a SIM card with or without PIN code in the Arduino Pro 4G Module. |
| 6 | + * 2. Provide sufficient power to the Arduino Pro 4G Module. Ideally, use a 5V power supply |
| 7 | + * with a current rating of at least 2A and connect it to the VIN and GND pins. |
| 8 | + * 3. Make sure the SIM card has enough credit to send SMS messages. |
| 9 | + * 4. Specify the APN, GPRS username, and GPRS password of your mobile network provider. |
| 10 | + * 5. Specify the PIN code of your SIM card if it has one. |
| 11 | + * 6. Specify the phone number of the recipient and the message you want to send. |
| 12 | + * 7. Upload the sketch to the connected Arduino board. |
| 13 | + * |
| 14 | + * Initial author: Sebastian Romero @sebromero |
| 15 | + */ |
| 16 | +#include "ArduinoCellular.h" |
| 17 | + |
| 18 | +const char apn[] = "internet"; |
| 19 | +const char gprsUser[] = ""; |
| 20 | +const char gprsPass[] = ""; |
| 21 | + |
| 22 | +ArduinoCellular cellular = ArduinoCellular(); |
| 23 | + |
| 24 | +void setup(){ |
| 25 | + Serial.begin(115200); |
| 26 | + while (!Serial); |
| 27 | + delay(1000); // Give the serial monitor some time to start |
| 28 | + |
| 29 | + cellular.begin(); |
| 30 | + String pinCode = "1234"; // If your SIM card has a PIN code, specify it here |
| 31 | + |
| 32 | + Serial.println("Connecting to network..."); |
| 33 | + cellular.connect(apn, gprsUser, gprsPass, pinCode); |
| 34 | + |
| 35 | + Serial.println("Sending SMS..."); |
| 36 | + cellular.sendSMS("+41791234567", "bleep bleep"); |
| 37 | + Serial.println("Done."); |
| 38 | +} |
| 39 | + |
| 40 | +void loop(){ |
| 41 | + delay(1000); |
| 42 | +} |
0 commit comments