#include < HardwareSerial.h >
HardwareSerial SIM800L(1); // Use hardware serial port 1 for SIM800L
void setup() {
Serial.begin(115200); // Initialize serial communication for debugging
SIM800L.begin(9600, SERIAL_8N1, 16, 17); // Initialize SIM800L at 9600 baud, using pins 16 (RX) and 17 (TX)
delay(1000); // Give the SIM800L module some time to initialize
SIM800L.println("AT"); // Send "AT" to the module and it should respond with "OK"
}
void loop() {
while (SIM800L.available()) {
Serial.write(SIM800L.read()); // Display SIM800L module response on Serial Monitor
}
while (Serial.available()) {
SIM800L.write(Serial.read()); // If any data is sent from Serial Monitor, send it to SIM800L module
}
}