Hi guys. sorry for the stupid question but i just started working with sim800l and arduino uno. I connected the softwareserial.h library, copied a simple code for sending SMS, and then a problem arose. I send an AT+CMGS command but I can't complete it.
After the line
SIM800.println("AT+CMGS=\"+79111112233\"");
An input field appears. The Hello text from the next line is entered, which is the SMS text. And then I have a problem with sending this same sms. As I understand it, <CTRL + Z> should be sent there, but I don’t understand how to do it correctly. This keyboard shortcut has the ASCII code 26. I tried to add it in many ways but no result. Can anyone give a hint?
#include <SoftwareSerial.h>
SoftwareSerial SIM800(8, 9); // 8 - RX Arduino (TX SIM800L), 9 - TX Arduino (RX SIM800L)
void setup() {
Serial.begin(9600); // Скорость обмена данными с компьютером
SIM800.begin(9600); // Скорость обмена данными с модемом
Serial.println("Start!");
delay(1000);
SIM800.println("AT");
updateSerial();
SIM800.println("AT+CMGF=1");
updateSerial();
SIM800.println("AT+CSCS=\"GSM\"");
updateSerial();
SIM800.println("AT");
updateSerial();
SIM800.println("AT+CMGS=\"+79111112233\"");
updateSerial();
SIM800.println("Hello");
delay(100);
SIM800.write(byte(26));
}
void loop() {
updateSerial();
}
void updateSerial()
{
delay(500); // Пауза 500 мс
while (Serial.available())
{
SIM800.write(Serial.read()); // Переадресация с последовательного порта SIM800L на последовательный порт Arduino IDE
}
while(SIM800.available())
{
Serial.write(SIM800.read()); // Переадресация c Arduino IDE на последовательный порт SIM800L
}
}