2019年9月21日 星期六

esp8266-1

嘗試了Microbit多種外掛模組後,還是連線失敗,電源也從電腦USB、3v電池盒、CR123A(麥坤小車上的)都換過了,還是失敗。

本癌想說周一再找找看有沒有USB-TTL線才有辦法和ESP8266做溝通,後來找到一個youtube影片,可以用arduino當作TTL。
https://www.youtube.com/watch?v=uUoPCoJIolc
裡面並附上了Arduino ino檔
把程式文字貼在這以免不見。
/*Author:
     |*******************************************|
     |1.K.Rajesh,B.Tech IT.                      |
     |*******************************************|
   pin 6->Rx
   pin 7->Tx
*/
#include<SoftwareSerial.h>
SoftwareSerial myserial(6,7);//RX,TX
void setup()
{
Serial.begin(9600);
myserial.begin(9600);
}
void loop()
{
   if(myserial.available()){
       Serial.write(myserial.read());
   }
   if(Serial.available())
       myserial.write(Serial.read());
}
但後來嘗試了之後,打入AT再序列埠中,一直只出現ERROR

google一下後,發現有人說可能是斷行符號的關係
The simple solution about it is:
Please send the AT message on Serial Monitor as : ‘AT\r\n’ . Since ESP8266 need carriage return and newline in the command.
Or, you can do like that
From the lower drop-down make sure you choose 'Both NL & CR' and 9600 baud rate.
It should work. May this helps you.
喔!改了NL&CR後,送出AT,回應果然出現"ok"啦!感動!
9/27新增
如果是motoduino的esp8266模組,則在此程式中的RX是綠色,TX是黃色!














AT+RST : 重新起始 ESP8266
AT+CIOBAUD?  : 查詢鮑率 (位元速率)
AT+CIFSR : 查詢 IP 位址
AT+CWMODE? : 查詢目前工作模式
AT+CWLAP : 列出附近偵測得到的基地台
AT+CWJAP="SSID","PWD" : 連線指定之基地台 (Join AP)

沒有留言:

張貼留言