-->
Page 1 of 1

esp8266 AT commands embedded code

PostPosted: Fri May 29, 2020 6:26 pm
by Kunal Gupta
hi to all ,

i am trying to write the embedded c code for esp8266 via AT commands .

flashed the AT commands firmware in the esp8266 . connected esp8266 via rx and tx with arduino mega pins 18-19.

Now first for testing purpose i am just sending the AT command and expecting the response from esp8266 as OK.




Quote
#include <uarts.h>
#include <avr/delay.h>
int main(void)
{ char buff[100];
//UART_Init0();
UART_Init3(); //for printing 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");

}}
this is code which i have written and sending the AT command via serial UART now but in response i am not getting the OK command i am getting output like this.

https://drive.google.com/file/d/... (green output when sending code coloured in green and blue when sending clue cloured code)

Now I have 2 questions

1) why i am not getting OK in response and instead getting the command which i am sending

2) does the response of AT commands had anything to with CR and NL ...



for reference below is my git repo for above uart functions ..

https://github.com/gkunalupta/uart-/blob/master/code