HOW TO GET VALUE FROM SMS?

hi guys, do you know how to get value for a variable from SMS?
ex.
i sent sms like this : CHANGE +628123456
then i want to get that number to be a value for a variable (ex.myNumber)
if you dont mind, please send me a code.

thank you.

Sorry, it doesn't work like that. You write the code, if you have a problem with it we will do our best to help.

I think the word you need to search on is 'parse'.

rrm94x:
if you dont mind, please send me a code.

If you write it we'll help you fix it for free. If you want someone to just give you the code then you have to go to the section called Gigs and Collaborations and you have to pay for it.

Delta_G:
If you write it we'll help you fix it for free. If you want someone to just give you the code then you have to go to the section called Gigs and Collaborations and you have to pay for it.

oh sorry buddy, here is my code

id send_sms(String text)
{
sim900.println("AT + CMGS = "+6285777200677""); //harus menggunakan kode negara, contoh +6287654321098
delay(500);
sim900.println(text);
delay(500);
sim900.println((char)26);
delay(500);
sim900.println();
}

if(myNumber && state>=2)
{
myNumber=false;

if(sms.indexOf("Led1on")>-1)
{
digitalWrite(led1,HIGH);
sms="";
send_sms("Led 1 Sudah Menyala");
}
else if(sms.indexOf("Led1off")>-1)
{
digitalWrite(led1,LOW);
sms="";
send_sms("Led 1 Sudah Mati");
}

the code above is the code that i know for read a message and do action, but i want to know how to store a message to a variable (ex. i sent SMS like this : "+628123456", and stored to a variabel : myNumber), then i want to replace +6285777200677 in my code with the number that i get from variabel myNumber.

Just use multiple print statements.

char* myNumber = "+628123456"
 sim900.print("AT + CMGS = \"");
sim900.print(myNumber);
sim900.println("\"");

Notice how we only use println for the last one and print for the others.

Delta_G:
Just use multiple print statements.

char* myNumber = "+628123456"

sim900.print("AT + CMGS = "");
sim900.print(myNumber);
sim900.println(""");




Notice how we only use println for the last one and print for the others.

thank you,
so when i send a SMS with a text like '+0888888' to my GSM module, the +088888 will replace +628123456 in variabel myNumber?
i hope you understand my question, my english not well, so i a little bit confused how to tell you what the point of my question. thank you.

Store the number in the on-board EEPROM. When it needs to be changed, overwrite the old one.

dannable:
Store the number in the on-board EEPROM. When it needs to be changed, overwrite the old one.

thank you for reply,
but it is possible to change the number via SMS?

I am writing some code for a project where I have a GSM module interfaced with an Arduino to communicate certain notifications when a sensor is triggered and to receive commands via SMS. One such command is to set the 'call out' number via SMS. IE if I send the word 'Set' to the GSM module, the number the message is received from becomes the new number that the GSM module will call out to when sensors are triggered.

I have to initialise a default phone number in the code:

char ph_number[]="+35387914xxxx";

Then within my program I have some code to check for any SMS' that contain the 'Set' command and if so set ph_number = to the senders number.

I need to then permanently save that new number to become the default call out number,. Is there a way to do this?

Maybe write the number to EEPROM.

ieee488:
Maybe write the number to EEPROM.

but it is possible just store the new number to a variabel (replace the default one that i input in code)?
it's okay if the new number only temporary not permanent

Why starting a new thread when you asked the same thing a few days ago, and got replies there already?

If you store the number in EEPROM then if the power goes off your number is safely saved. If you use a variable then when power goes off it resets to the original version.

wvmarle:
Why starting a new thread when you asked the same thing a few days ago, and got replies there already?

Should have checked his posts first.

This sort of bad behavior makes me not want to help.

Waste of time.