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.
7 years, 11 months ago.
ATCmdParser doesn't work
Hi,
I used below code to communicate with GPRS module by using ATCmdParser, but it doesn't work, can you help to comment?
platform: NUCLEO F412ZG
AT UART: UART 1
UARTSerial test_serial = UARTSerial(PA_9, PA_10, 9600);
ATCmdParser at = ATCmdParser(&test_serial, "\r\n");
at.send("AT") && at.recv("OK");
at.send("AT+CWMODE=%d", 3) && at.recv("OK");
at.send("AT+CWMODE?") && at.recv("+CWMODE:%d\r\nOK", &value);
looks like it was blocked in receive data.
1 Answer
7 years, 11 months ago.
I think that you need to do:
at.send("AT+CWMODE?") && at.recv("+CWMODE:%d", &value) && at.recv("OK");
As the \r\n
is the delimiter character and thus shouldn't be in the recv() command. This is how we do it in the esp8266 driver at least.
update: I add log in the receive function, I can get the raw data from getc(); but at last it return fail. maybe because the data input format is wrong? any user guide for ATCmdParser?
posted by colin liao 03 Oct 2017