大家好,
我正在尝试通过 AT 命令为 esp8266 编写嵌入式 c 代码。
在 esp8266 中刷入 AT 命令固件。通过 rx 和 tx 与 arduino mega 引脚 18-19 连接 esp8266。
现在首先出于测试目的,我只是发送 AT 命令并期望 esp8266 的响应正常。
代码:
全选#include
#include
int main(void)
{ char buff[100];
//UART_Init0();
UART_Init3(); //for prin
ting on serial monitor
UART_Init1(); ///for esp bauddrate is selected 115200
printString3("******************hellow*****************");
printString3("\n");
while(1)
{
printString3("type a command \n");
printString1("AT"); //sending command to esp8266
printString3("AT \n"); //printing command to terminal screen
printString3("received response \n");
// rxstring1(buff);//blue colour
for(int i=0;i<2;i++) //green colour
{
buff=UART_RxChar1();
UART_TxChar3(buff);
_delay_ms(1000);
}
//printString3(buff);
printString3("\n");
}}
这是我现在编写并通过串行 UART 发送 AT 命令的代码,但作为响应,我没有收到 OK 命令,我得到的是这样的输出。
https://drive.google.com/file/d/ .. (在发送线索代码时发送绿色和蓝色代码时的绿色输出)现在我有 2 个问题1)为什么我没有得到 OK 响应而是得到我正在发送的命令2)AT 命令的响应是否有与 CR 和 NL 有关的任何内容...供参考,下面是我的上述 uart 函数的 git repo ..
https://github.com/gkunalupta/uart-/blob/master/code