I need a code for turn on and off led with sim800L/arduino

hello
please i need code to turn on and off my led with sim800L/arduino
i use many source code but not working with me
my RX in 10
my Tx in 11
My pin led 5V in 13
i have this code but i havent TX AND RX
and my led turn on 20s and turnoff 20s automatic so i need one led control with message text like ON for TURN ON and OFF for TURN OFF

#include <Sim800l.h>
#include <SoftwareSerial.h> 
Sim800l Sim800l; 
String text;    
uint8_t index;  
uint8_t LED=13; 
String textSms;

void setup(){
   pinMode(LED,OUTPUT); 
 
  Serial.begin(9600); 
  Sim800l.begin();  
  Sim800l.delAllSms();
}
void loop(){
  text=Sim800l.readSms(1);
  if (text.indexOf("TURNON")!=-1){
    Serial.println(text);
                    Serial.println("LED TURN ON");
                    digitalWrite(LED,1);
                    Sim800l.delAllSms();
                }    
  if (text.indexOf("TURNOFF")!=-1){
                    Serial.println("LED TURN OFF");
                    digitalWrite(LED,0);
                    Sim800l.delAllSms();
                }
}

what is your native language?

arabic and i have bad english :frowning:

استخدم مترجم جوجل. اكتب وصفك لما تريد القيام به باللغة العربية ودع جوجل يترجم النص العربي. ستحصل على إجابات أسرع وأفضل بكثير إذا كتبت وصفًا تفصيليًا ودقيقًا باللغة العربية ثم تركت ترجمة جوجل تقوم بالترجمة.

aistakhdim mutarjim jujil. auktub wasfak lima turid alqiam bih biallughat alearabiat wadae jujil yutarjim alnasa alearabia. satahsul ealaa 'iijabat 'asrae wa'afdal bikathir 'iidha katabat wsfana tfsylyana wdqyqana biallughat alearabiat thuma tarakat tarjamat jujil taqum bialtarjamati.

i use Google translate. Write your description of what you want to do in Arabic and let Google translate the Arabic text. You will get much faster and better answers if you write a detailed and accurate description in Arabic and then let Google Translate do the translation.

IM USE GOOGLE TRANSLATE BUT I FIND SOME PROBLEMS IN CODE THIS IS MY BAD CODE

#include <Sim800l.h>
#include <SoftwareSerial.h> 
Sim800l Sim800l; 
String text;    
uint8_t index;  
uint8_t LED=13; 
String textSms;

void setup(){
   pinMode(LED,OUTPUT); 
 
  Serial.begin(9600); 
  Sim800l.begin();  
  Sim800l.delAllSms();
}
void loop(){
  text=Sim800l.readSms(1);
  if (text.indexOf("TURNON")!=-1){
    Serial.println(text);
                    Serial.println("LED TURN ON");
                    digitalWrite(LED,1);
                    Sim800l.delAllSms();
                }    
  if (text.indexOf("TURNOFF")!=-1){
                    Serial.println("LED TURN OFF");
                    digitalWrite(LED,0);
                    Sim800l.delAllSms();
                }
}

أنا متأكد تمامًا إذا كنت تستخدم مترجم جوجل ، يمكنك أن تصف بجمل كاملة ما تريد القيام به بالتفصيل وبالتفصيل.

إذا كنت لا تزال تكتب جمل قصيرة جدًا ، فسيستغرق الأمر وقتًا أطول لأنه يتعين عليك طرح الكثير من الأسئلة.
لذا اكتب بالعربية بالتفصيل على الفور.

I am quite sure if you use google-translate you can describe in full sentences what you want to do in full and in detail.

If you still write very short sentences it will take a lot longer because you have to ask a lot of questions.
So write in Arabic in detail right away.

upload this code and test if the initialisation is working.
This code is doing a most basic check if the communication works at al
and it will print the content of received SMS-messages
So as a first step lets see if this is wokring

/*  Copyright to AyushMarsian(Ankit Ghevariya)
 *  Licence GNU GPL V3
 *  
 *  Example for read SMS from perticular location of memory
 *  Written by Ankit Ghevariya, public domain
 *  
 *  You have to connect pin as written below
 *  (GSM) --------- (Arduino)
 *   Vcc  --------> 3.8v to 4.2v (Do not give 5v(Damage) or 3.3v(Under voltage))
 *   RST  --------> Digital 9 (Optional, only if you want to perform hardware reset)
 *   TxD  --------> Digital 10
 *   RxD  --------> Digital 11
 *   Gnd  --------> Gnd
 */
 
#include <SIM800L.h>
#include <SoftwareSerial.h>

SoftwareSerial GSMserial(10, 11); // RX, TX
SIM800L gsm;

String message="";

void setup() 
{
  Serial.begin(9600);
  GSMserial.begin(9600);
  
  if(gsm.begin(GSMserial)) // Will return 1 if GSM responds and SIM card inserted then
  {
    Serial.println("GSM Initialized");
  }
  else
  {
    Serial.println("GSM not responding");
    while(1); // Infinite loop, code will not execute other stuff
  }
  
  message=gsm.readSMS(1); // Read a SMS from location 1 and store content into message variable.

  if(message.length()==0)
  {
    Serial.println("Message is Empty");
  }
  else
  {
    Serial.print("Message :");
    Serial.println(message);
  }
}

void loop()
{
  
}

best regards Stefan

not working bro
but i cant find output for give 5v to my LED ? and messages too like if i send ON my led turn ON or when i send OFF my led will turn off

أتوقف عن الإجابة لأنك تكتب إجابات قصيرة جدًا. آسف لا مزيد من المساعدة

yes i write small answer because i have bad english so im sorry about that

https://translate.google.com

https://translate.google.de/?hl&ie=UTF-8&sl=en&tl=ar&text=What%20is%20so%20hard%20to%20use%20google-translate%3F%3F%3F%3F%3F%20So%20as%20your%20last%20chance%3A%20write%20in%20arabic%20arabic%20arabic%20arabic%20and%20write%20a%20very%20very%20very%20very%20long%20description%20of%20what%20you%20want%20to%20do%20and%20what%20you%20have%20tested%20so%20far&op=translate

ما هي صعوبة استخدام مترجم جوجل ؟؟؟؟؟ إذاً ، كفرصتك الأخيرة: اكتب بالعربية العربية العربية واكتب وصفًا طويلًا جدًا جدًا لما تريد القيام به وما اختبرته حتى الآن

السلام عليكم
شكرا لك على مجهودك يا أخي
أنا أتوفر على قطعة
arduino uno+ sim800l
أريد إرسال رسالة نصية من الهاتف بها كلمة تشغيل ON
ليشتغل المصباح
و لا ينطفى حتى أرسل رسالة بها كلمة إيقاف off
عندما يشتغل المصباح أتوصل برسالة في رقمي الحاص به لقد إشتغل المصباح و عند التوقف أتوصل برسالة بها لقد توقفت

و شكرا

DU

möchtest Hilfe haben.
Also must

DU dir Mühe geben.

Du

musst die Übersetzung in google-translate eingeben.
NICHT ICH!!!

AH OK I UNDERSTAND NOW THANK YOU
Thank you for your effort, brother
I have a piece
arduino uno+ sim800l
I want to send a text message from the phone with the word ON
To turn on the lamp
And it does not turn off until I send a message with the word “off”
When the lamp turns on, I receive a message in my number. The lamp is on, and when I stop, I receive a message saying it has stopped.

Thank you

You will have a long journey to understand how you have to provide information to receive effective help.
does the code of post #5 work?

this code NOT WORKING because if i use it my relay Turns on automatically after every 20 seconds and turns off after 20s all times without any message from my phone

#include <Sim800L.h>
#include <SoftwareSerial.h> 
Sim800L Sim800L; 
String text;    
uint8_t index;  
uint8_t LED=13; 
String textSms;

void setup(){
   pinMode(LED,OUTPUT); 
 
  Serial.begin(9600); 
  Sim800L.begin();  
  Sim800L.delAllSms();
}
void loop(){
  text=Sim800L.readSms(1);
  if (text.indexOf("TURNON")!=-1){
    Serial.println(text);
                    Serial.println("LED TURN ON");
                    digitalWrite(LED,1);
                    Sim800L.delAllSms();
                }    
  if (text.indexOf("TURNOFF")!=-1){
                    Serial.println("LED TURN OFF");
                    digitalWrite(LED,0);
                    Sim800L.delAllSms();
                }
}

step 1 of 10.000 to learn how to get effectice help:
the code you have posted does not switch a relay.
add serial debug-output

thank you stefan my friend help me for fix it
btw my problem not in code
my problem is my power source in sim800L i need to power of 5V 2A but me im using 5v 0.5A

سأساعدك فقط إذا كانت منشوراتك تستخدم 10 جمل على الأقل

استخدم مترجم جوجل