I want to send sms when my device receive request, and i am getting proper data. But the problem is my arduino and gsm shield continuously send sms but i want to send one sms only.
That is not a picture. That is NOT a reason to use a stupid name like mySerial. Why not name the instance to reflect that is ACTUALLY connected to the SoftwareSerial pins? There is no reason not to use
SoftwareSerial sim900A(2,3);
There is no reason to call Serial.begin() when there are no Serial.print() statements.
On the other hand, there is NO reason no to have Serial.print() statements when you do not know what the code is actually doing.
Use Tools + Auto Format before posting code again. Read the stickies and post the code correctly next time.
sarouje:
what value the below line read after power off and On the system, is it 'T'?
inchar=mySerial.read();
Hope it's not 'T'
Now send a read request, I assume it's 'T'. After this read request, what value you are getting when you do mySerial.read()
Hello,
On power ON it reads last sms and if it is 'T' than send sms. If last sms is not 'T' than system dont send any sms , when i send request 'T' it start sending SMS continuously (Temp & Humidity value) ..
On power ON it reads last sms and if it is 'T' than send sms. If last sms is not 'T' than system dont send any sms , when i send request 'T' it start sending SMS continuously (Temp & Humidity value) ..
I do not see how do you read the SMS itself. Normally mode 2 and mt of 2 on the CNMI would report the SMS on the serial on a form of:
+CMT: [<alpha>],<length><CR><LF><pdu>
where pdu is the message that was received.
I do not see any Local Echo turning off as well, so you might also be capturing all the 'T''s in your own commands as well....
The first char is T and not sure whether you are getting it back when you do mySerial.read(). Just an assumption.
Most probably he is. According to SIM900 data sheet local echo (or command echo) is ON by default. So everything he sends to the soft serial are echoing back to the arduino. Which in turns searches for T's and sends SMS which in turn echoes to the arduino etc etc etc.
@OP
First thing EVER, turn local echo off. Just a simple ATE0 and you are done.
Second, your code assumes to much. Use a serial cable or the proper sketch to manually interact with the shield and see how it response to your commands. And then write the proper parsing code..
Or if you do not need to learn something, just use the ready made libraries!