Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 7 months ago.
sim800L communication with STM32F334
I am trying to send AT command to stm32 but I am getting error while sending AT command
- include "mbed.h"
- include <string> Serial pc(SERIAL_TX, SERIAL_RX); pc comunication Serial SIM900(PA_9, PA_10); tx, rx SIM 900 string result; char x;
void clearString() { result.clear(); }
void controlAT() { clearString(); wait_ms(100); SIM900.printf("AT\r\n");
wait_ms(200);
if(result=="\r\nOK\r\n") {
pc.printf("\r\nOK AT\r\n");
}else {
pc.printf(" ERROR AT "); this line is printing
}
pc.printf("%s",result.c_str());
}
void sendSMS()
{
pc.printf("\r\nsendSMS2\r\n");
clearString();
SIM900.printf("AT+CMGS=");
SIM900.printf("\"");
SIM900.printf("074xxxxx");
SIM900.printf("\"");
SIM900.printf("\r");
wait_ms(200);
SIM900.printf("Hello");
SIM900.printf("\r");
SIM900.putc(0x1A);
wait_ms(200);
pc.printf("%s",result.c_str());
clearString();
}
int main() {
pc.printf("\r\n GSM 900 TEST\n");
SIM900.baud(9600); wait_ms(200);
controlAT(); wait_ms(200); sendSMS(); SEND SMS wait_ms(200);
}
I am getting error in controlAT() function and it always printing pc.printf(" ERROR AT "); this is a error
Please help me to resolve this issue
Can anyone help me to resolve this issue
posted by gautam tripathi 17 Jun 2016