Created
August 28, 2022 19:43
-
-
Save hmasum52/0b82d6c3904a5dada1d13d15229cc81d to your computer and use it in GitHub Desktop.
Sim 900a GSM module test code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SoftwareSerial.h> | |
#define RXgsm 10 | |
#define TXgsm 11 | |
const uint32_t GSMBaud = 115200; | |
SoftwareSerial gsmSerial(RXgsm, TXgsm); | |
void sendMessage(String msg) | |
{ | |
gsmSerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode | |
delay(1000); // Delay of 1000 milli seconds or 1 second | |
gsmSerial.println("AT+CMGS=\"+8801XXXXXXXXX\"\r"); // Replace x with mobile number. +880 is the country code for bangladesh | |
delay(1000); | |
Serial.print(" Sending SMS!"); | |
gsmSerial.println(msg);// The SMS text you want to send | |
delay(100); | |
gsmSerial.println((char)26);// ASCII code of CTRL+Z | |
delay(1000); | |
} | |
void setup() | |
{ | |
gsmSerial.begin(GSMBaud); | |
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino) | |
delay(100); | |
sendMessage("Hello from the other side!"); | |
} | |
void loop() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment