2017-04-20 7 views
0

Arduino UNO가있는 ESP8266 무선 랜 모듈에 연결했습니다. 핀 구성이 좋습니다. 직렬 모니터에서 AT 명령을 보냈지 만 OK라고 응답했지만 AT + RST를 보내면 작동하지 않습니다.ESP8266의 반응은 OK이지만 재설정 할 수 없습니다

ððAT 


OK 
AT+RST 


OK 

ets Jan 8 2013,rst cause:2, boot mode:(3,7) 

load 0x40100000, len 1396, room 16 
tail 4 
chksum 0x89 
load 0x3ffe8000, len 776, room 4 
tail 4 
chksum 0xe8 
load 0x3ffe8308, len 540, room 4 
tail 8 
chksum 0xc0 
csum 0xc0 

2nd boot version : 1.4(b1) 
SPI Speed  : 40MHz 
SPI Mode  : QIO 
SPI Flash Size & Map: 8Mbit(512KB+512KB) 
jump to run user1 @ 1000 

ŒÃÕ�MEM CHECK FAIL!!! 
ärl�‚sò 
Ai-Thinker Technology Co. Ltd. 

invalid 

내가 아두 이노 우노으로 재설정 할 수 있습니다 방법 AT + RST 모든의

+0

작동하지 않는다는 의미는 무엇입니까? 분명히 자체를 다시 설정합니다. –

+0

yes.gre_gor이 맞습니다. Ans가 혼란 스럽습니다. 결국 무효입니다. – Billa

+0

예, 결국 무효로 혼란스러워했습니다. 그러나 지금은 그 일을 –

답변

1

먼저가있을 완벽 해 내가 작업 할 때 많은 우연히 ok 하드웨어 연결이 때문에 일반적인 bugs.Have에있는 반환 it.secondly esp8266을 재설정해야하는 이유가 있습니까?

코드 :

#include <SoftwareSerial.h> 

SoftwareSerial esp8266(2,3); // make RX Arduino line is pin 2, make TX Arduino line is pin 3. 
          // This means that you need to connect the TX line from the esp to the Arduino's pin 2 
          // and the RX line from the esp to the Arduino's pin 3 
void setup() 
{ 
    Serial.begin(9600); 
    esp8266.begin(9600); // your esp's baud rate might be different 
} 

void loop() 
{ 
    if(esp8266.available()) // check if the esp is sending a message 
    { 
    while(esp8266.available()) 
    { 
     // The esp has data so display its output to the serial window 
     char c = esp8266.read(); // read the next character. 
     Serial.write(c); 
    } 
    } 



    if(Serial.available()) 
    { 
    // the following delay is required because otherwise the arduino will read the first letter of the command but not the rest 
    // In other words without the delay if you use AT+RST, for example, the Arduino will read the letter A send it, then read the rest and send it 
    // but we want to send everything at the same time. 
    delay(1000); 

    String command=""; 

    while(Serial.available()) // read the command character by character 
    { 
     // read one character 
     command+=(char)Serial.read(); 
    } 
    esp8266.println(command); // send the read character to the esp8266 
    } 
} 

이 코드의 목표는 간단합니다 ESP8266로 보낼 아두 이노의 시리얼 창에서 AT 명령을 수신하고 명령 또는 기타 작업에 ESP8266의 응답을 인쇄 (예 : HTTP 요청 받기).

상기 코드 세그먼트가 실패 (일부 경우에 발생한다) 경우 (serial.available()) 코드 블록은 다음과 같은 세그먼트를 사용하는 동안 대체 : I 문자열 데이터 유형을 삭제

while(Serial.available()) // read the command character by character 
    { 
    // read one character from serial terminal 
    char ch = Serial.read(); 
    // send that one character to the esp8266 
    esp8266.print(ch); // send the read character to the esp8266 
    } 

참고.

당신이 다음 코드 세그먼트 다음 사용해야한다 ESP8266에 아두 이노에서 직접 명령을 보내려면 :

사용 ESP8266에 연결이 코드 :

#include <SoftwareSerial.h> 

const byte rxPin = 2; // Wire this to Tx Pin of ESP8266 
const byte txPin = 3; // Wire this to Rx Pin of ESP8266 

// We'll use a software serial interface to connect to ESP8266 
SoftwareSerial ESP8266 (rxPin, txPin); 

void setup() { 
    Serial.begin(115200); 
    ESP8266.begin(115200); // Change this to the baudrate used by ESP8266 
    delay(1000); // Let the module self-initialize 
} 

void loop() { 
    Serial.println("Sending an AT command..."); 
    ESP8266.println("AT"); 
    delay(30); 
    while (ESP8266.available()){ 
    String inData = ESP8266.readStringUntil('\n'); 
    Serial.println("Got reponse from ESP8266: " + inData); 
    } 
} 

PS : 잊지 마세요 직렬 모니터에서 끝나는 행을 개 선 또는 캐리지 리턴으로 설정하십시오.

위의 코드 세그먼트에서 IAM은 데모를 위해 AT 명령 (ESP8266.println("AT");) 만 전송합니다. 동일한 방법으로 모든 명령을 보낼 수 있습니다.

+0

받아 들여주세요. – Billa