So, It is not possible in SIM800A module?
#include <SoftwareSerial.h>
SoftwareSerial SIM900(8, 9);
bool started=false;
char *mystrings[] = {"AT+CGSN","AT+CIMI","AT+CSQ"};
void setup() {
Serial.begin(9600);
SIM900.begin(9600);// put your setup code here, to run once:
SIM900.println("GSM900 Testing....");
if(started=false)
{
Serial.println("status=IDLE");
}
else
{
Serial.println("status=READY");
}
delay(1000);
}
void loop() {
SIM900.println("AT");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CIPSHUT");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CIPMODE=0");
delay(2000);
ShowSerialData();
delay(2000);
SIM900.println("AT+CIPMUX=0");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CGATT=1");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CREG?");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CGATT?");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CSTT="www","",""");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CIICR");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CIFSR");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CIPSTART="TCP","xxxxxxxxxx","xxxxxxxx"");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CIPSEND");
delay(5000);
ShowSerialData();
delay(5000);
printdata();
SIM900.println("\r\n\x1A");
delay(10000);
ShowSerialData();
delay(5000);
SIM900.println("AT+CIPCLOSE=0");
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println("AT+CIPSHUT");
delay(1000);
ShowSerialData();
delay(1000);
}
void ShowSerialData()
{
while(SIM900.available()!=0)
Serial.write((SIM900.read()));
delay(500);
/* for(int i=0;i<3;i++)
{
SIM900.println(mystrings*);*
- delay(1000);*
_ } */_
}
void printdata()
{ - while(SIM900.available()!=0)*
- Serial.print(char(SIM900.read()));*
- delay(500);*
- for(int i=0;i<3;i++)*
- {*
_ SIM900.println(mystrings*);_
_ SIM900.print('0xla');_
_ delay(1000);_
_ }_
_}*_
sterretje:
Show YOUR code; just in case, don't forget code tags.
I uploaded my codes. please check and notify what's wrong with them.
please Help!!!!!
Thanks in advanced
Please do us all a favour and put code tags around your code as suggested to prevent parts of it being turned into italics
See Read this before posting a programming question for details
void ShowSerialData()
{
while(SIM900.available()!=0)
{
char ch = SIM900.read();
Serial.write(ch);
Serial.print(", HEX value = ");
if(ch <0x10)
{
Serial.print("0");
}
Serial.print(ch, HEX);
Serial.print("|");
}
delay(500);
}
This will give you (and us) a better insight in what you actually receive.
vaibhavs23:
I read all your answers because I make the same project.
Your code does not match the earlier answers. You will have to collect the data in a nul-terminated array; once a complete message is received you can start filtering what is needed. Have a look at the getReply() function in reply #14.
sterretje:
This will give you (and us) a better insight in what you actually receive.
Your code does not match the earlier answers. You will have to collect the data in a nul-terminated array; once a complete message is received you can start filtering what is needed. Have a look at the getReply() function in reply #14.
How collect null terminated data, can you please help. i am stucked from2 days at this point.
As I said, have a look at the getReply() function in reply #14.
sterretje:
As I said, have a look at the getReply() function in reply #14.
sterretje:
As I said, have a look at the getReply() function in reply #14.
I saw that but I did not get. And also how to use and implement in my code.
sterretje:
void ShowSerialData()
{
while(SIM900.available()!=0)
{
char ch = SIM900.read();
Serial.write(ch);
Serial.print(", HEX value = ");
if(ch <0x10)
{
Serial.print("0");
}
Serial.print(ch, HEX);
Serial.print("|");
}
delay(500);
}
This will give you (and us) a better insight in what you actually receive. Your code does not match the earlier answers. You will have to collect the data in a nul-terminated array; once a complete message is received you can start filtering what is needed. Have a look at the getReply() function in reply #14.
what about this code and where it's actually implement in my code.
UKHeliBob:
Please do us all a favour and put code tags around your code as suggested to prevent parts of it being turned into italicsSee Read this before posting a programming question for details
Please, help me about this project.
vaibhavs23:
what about this code and where it's actually implement in my code.
That code will tell you exactly what you will be receiving; just replace your current function with it. Use it the same way as you currently do. Show us the result (copy and paste from serial monitor). After that we can help you further.
Use below code; it might be that you need more commands before you issue "AT+CGSN", I don't know. But we need the exact output of that command.
void loop() {
SIM900.println("AT+CGSN");
delay(1000);
ShowSerialData();
Serial.println("===========");
delay(1000);
}
vaibhavs23:
UKHeliBob:
Please do us all a favour and put code tags around your code as suggested to prevent parts of it being turned into italicsSee Read this before posting a programming question for details
Please, help me about this project.
Please consider to do what we ask you to do; you will not make yourself very popular if you don't and as a result people will be reluctant or refuse to help you.
sterretje:
That code will tell you exactly what you will be receiving; just replace your current function with it. Use it the same way as you currently do. Show us the result (copy and paste from serial monitor). After that we can help you further.
Use below code; it might be that you need more commands before you issue "AT+CGSN", I don't know. But we need the exact output of that command.void loop() {
SIM900.println("AT+CGSN");
delay(1000);
ShowSerialData();
Serial.println("===========");
delay(1000);
}
This Is Code:
#include <SoftwareSerial.h>
SoftwareSerial SIM900(8, 9);
boolean started=false;
void setup() {
Serial.begin(9600);
SIM900.begin(9600);// put your setup code here, to run once:
SIM900.println("GSM900 Testing....");
if(started=false)
{
Serial.println("status=IDLE");
}
else
{
Serial.println("status=READY");
}
delay(1000);
}
void loop()
{
SIM900.println("AT+CGSN");
delay(1000);
ShowSerialData();
Serial.println("===========");
delay(1000);
}
void ShowSerialData()
{
while(SIM900.available()!=0)
{
char ch = SIM900.read();
Serial.write(ch);
Serial.print(", HEX value = ");
if(ch <0x10)
{
Serial.print("0");
}
Serial.print(ch, HEX);
Serial.print("|");
}
delay(500);
}
This Is Output:
, HEX value = 0A|8, HEX value = 38|6, HEX value = 36|2, HEX value = 32|9, HEX value = 39|5, HEX value = 35|2, HEX value = 32|0, HEX value = 30|2, HEX value = 32|5, HEX value = 35|8, HEX value = 38|0, HEX value = 30|7, HEX value = 37|7, HEX value = 37|6, HEX value = 36|8, HEX value = 38|
, HEX value = 0D|
, HEX value = 0A|===========
Please see the output which was i got...
Hey Dear,
Actually, I want my command string output in one single line(i.e.Horizontal line).
This is My code:
#include <SoftwareSerial.h>
SoftwareSerial SIM900(8, 9);
boolean started=false;
void setup() {
Serial.begin(9600);
SIM900.begin(9600);// put your setup code here, to run once:
SIM900.println("GSM900 Testing....");
if(started=false)
{
Serial.println("status=IDLE");
}
else
{
Serial.println("status=READY");
}
delay(1000);
}// put your setup code here, to run once:
void loop() {
String IMEI = ("AT+CGSN");
String IMSI = ("AT+CIMI"); // put your main code here, to run repeatedly:
SIM900.println(IMEI);
delay(1000);
ShowSerialData();
delay(1000);
SIM900.println(IMSI);
delay(1000);
ShowSerialData();
delay(1000);
void ShowSerialData()
{
while(SIM900.available()!=0)
Serial.write(char(SIM900.read()));
delay(500);
}
This Is My Output:
status=READY
862952025807768
404201448798749
And actually I want the output in this manner:
862952025807768|404201448798749
You still haven't read the link that UKHeliBob posted in reply #23. Or you refuse to apply it. Read point 6, Getting help on the forum, specifically where it mentions [code] ... [/code]
.
Please pay attention how you reply; I did not see that you posted the output.
I will try to look at this tomorrow.
Reply #31 seems to indicate that the end of a reply contains (0x0D and 0x0A). If you want the reply of the two AT commands printed on a single line, you should simply ignore those characters.
void ShowSerialData()
{
while(SIM900.available()!=0)
{
// read character from SIM900
char ch = SIM900.read();
// if it's not <CR> and it's not <LF>
if(ch != '\r' && ch != '\n')
{
// write the character to serial port
Serial.write(ch);
}
}
delay(500);
}
Code not tested
PS
Please take note how I posted the code.
thanks a lot dear for help!!!1
actually , I am new on forum that's why all this mistake done from me.
So Big Sorry for this.
And again Thanks a lot for support!
sterretje:
Reply #31 seems to indicate that the end of a reply contains (0x0D and 0x0A). If you want the reply of the two AT commands printed on a single line, you should simply ignore those characters.void ShowSerialData()
{
while(SIM900.available()!=0)
{
// read character from SIM900
char ch = SIM900.read();
// if it's not and it's not
if(ch != '\r' && ch != '\n')
{
// write the character to serial port
Serial.write(ch);
}
}
delay(500);
}
Code not tested PS Please take note how I posted the code.
I tested this code the result was ok but when I am send this code to the TCPIP server it's not send.
why this happned any Idea....????
but when I am normally text data send to server it will sent successfully.
why this is happned?????
please help!!!
"This is My code:"
To put your code in a code box, use the </> icon in the far left of the post tool bar and paste your code between the two bracket sets that appear.
To go back and put your code in a code box, in the bottom right of your post, select "more" and click modify. When the modify post opens, high light your code and click the </> in the far left of the post tool bar. This will put you code in code brackets. Then save the changes.
You should read the "Read this before posting a program question..." at the top of the discussion list.
zoomkat:
"This is My code:"To put your code in a code box, use the </> icon in the far left of the post tool bar and paste your code between the two bracket sets that appear.
To go back and put your code in a code box, in the bottom right of your post, select "more" and click modify. When the modify post opens, high light your code and click the </> in the far left of the post tool bar. This will put you code in code brackets. Then save the changes.
You should read the "Read this before posting a program question..." at the top of the discussion list.
Thanks a lot Dear...!