Hello everyone, I am making a gsm intercom where by pressing a button you will have through the sim800l module the telephone call to a number, I have also added an i2c lcd with which you are invited to press the button to call, by pressing the button the module sim makes the call and the display communicates that it is calling … but as soon as the call ends how can I tell the display that the call has ended and then it should display it for a few seconds and then return to the text of: press the button to call , if I insert it in the loop module I will always have the same text repeated, I find myself in difficulty, I also added the ATA parameter to answer automatically when I call my intercom and this does it well after a few rings, the only problem is what the message does not return to the display press the button to call, another interesting thing would be to be able to automatically enter the number and store it in the arduin memory or in order to make the GSM intercom independent from the programmer who will have to program the number for each customer, can someone help me? here is the code I made so far:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define Button_call 5
#include "SoftwareSerial.h"
SoftwareSerial mySerial(2, 3);
void setup(){
lcd.begin();
lcd.backlight();
Serial.begin(9600);
mySerial.begin(9600);
pinMode(Button_call , INPUT_PULLUP);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("PRESS BUTTON");
lcd.setCursor(0, 1);
lcd.print("FOR CALLING ");
}
void loop(){
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
if (mySerial.println("RING")){
mySerial.println("ATA");
}
}
if (digitalRead(Button_call ) == LOW) {
Serial.println("Button_call PRESSED");
mySerial.println("ATD+39338.....;");
delay(10);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("WAITHING");
lcd.setCursor(0, 1);
lcd.print("CALLING...");
delay(20);
}else{
}
}