0
sim Ich versuche, AT-Befehl zu STM32 zu senden, aber ich Störung erhalte, während AT-Befehl sendenFehler beim von STM32 AT-Befehl sendet 800
#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");
wait_ms(1000);
if(result=="\r\nOK\r\n") {
pc.printf("\r\n----OK AT----\r\n");
}else {
pc.printf("-- ERROR AT --"); //this is a error
}
pc.printf("%s",result.c_str());
}
void sendSMS()
{
pc.printf("\r\n----sendSMS2----\r\n");
clearString();
SIM900.printf("AT+CMGS=");
SIM900.printf("\"");
SIM900.printf("074xxxxx");
SIM900.printf("\"");
SIM900.printf("\r");
wait_ms(200); // this create the problem
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);
}
Ich erhalte Fehler in controlAT() Funktion und es immer Drucken pc.printf ("- FEHLER AT -"); // Dies ist ein Fehler
Bitte helfen Sie mir dieses Problem
aber unten verknüpfen sie sagt, es funktioniert http://stackoverflow.com/questions/31454683/send-sms-with -stm32l152-und-sim900 – Gautam