ATCmdParser example for mbed OS
This is a example showing ATCmdParser usage with ESP8266 WiFi module.
The program retrieves the FW version of the ESP8266 module connected over UART using AT commands.
To connect the ESP8266 module to your development board, look at the ESP8266 Cookbook page. In general, this means hooking up the ESP8266 TX pin to D1
and the ESP8266 RX pin to D0
on your development board.
-
Import the example
mbed import mbed-os-example-atcmdparser cd mbed-os-example-atcmdparser
-
Compile and generate binary
For example, for
ARMCC
:mbed compile -t ARM -m K64F
-
Open a serial console session with the target platform using the following parameters:
- Baud rate: 9600
- Data bits: 8
- Stop bits: 1
- Parity: None
-
Copy or drag the application
mbed-os-example-atcmdparser.bin
in the foldermbed-os-example-atcmdparser/BUILD/<TARGET NAME>/<PLATFORM NAME>
onto the target board. -
The serial console should display a similar output to below, indicating a successful AT communication:
ATCmdParser with ESP8266 example
AT> AT+GMR
AT? SDK version:%*d%n
AT< AT+GMR
AT<
AT< AT version:1.3.0.0(Jul 14 2016 18:54:01)
AT= SDK version:2
AT? OK%n
AT< .0.0(656edbf)
AT< compile time:Jul 19 2016 18:44:44
AT= OK
ATCmdParser: Retrieving FW version
ATCmdParser: FW version: 2
ATCmdParser: Retrieving FW version success
Done
More information on the ATCmdParser API can be found in the mbed handbook.