ESP8266을 USB-TTL 직렬 변환하여 Wi-Fi 확인
브레드 보드 배선
이번 Arduino는 ESP8266에 3.3V 전원을 공급하는 용도로 사용합니다. USB-TTL 직렬 변환 케이블은 PL2303HX 칩을 탑재하고 있습니다. ESP8266과 PL2303HX는 모두 3.3V에서 동작한다. USB 케이블은 Windows의 USB 포트에 연결합니다.

CoolTerm
Windows에 CoolTerm을 설치합니다. CoolTerm에서 ESP8266으로 직렬 연결하여 AT 명령을 실행합니다. ESP8266의 AT 명령은 Wiki에 참조가 있습니다.
연결 확인
CoolTerm을 시작한 후 Options 버튼을 눌러 설정을 확인합니다. 이번 환경에서는 COM7 포트를 사용합니다.

Terminal 탭을 클릭합니다.
Handle BS and DEL Characters
에 체크를 해 터미널에서 BackSpace 키를 사용할 수 있도록 합니다.
Receive 탭에서
Capture Local Echo
를 확인하여 나중에 테스트 할 HTTP 응답을 볼 수 있습니다.
아 T
아 T 에서 ESP8266에 대한 연결을 테스트합니다.

AT+GMR
AT+GMR 에서 펌웨어 버전을 표시합니다.
AT+GMR
0018000902-AI03
OK
AT+CWJAP
AT+CWJAP 에서 액세스 포인트에 연결합니다. SSID와 비밀번호를 입력합니다.
AT+CWJAP="ssid","pwd"
OK
AT+CIPSTART
AT+CIPSTART 에서 Meshblu 서버에 연결합니다.
AT+CIPSTART="TCP","xxx.xxx.xxx.x",3000
OK
Linked
AT+CIPSEND
AT+CIPSEND 은 최초로 송신하는 데이터의 바이트수를 지정합니다. HTTP 요청 문자열은 다음과 같습니다. 마지막은 빈 줄입니다.
GET /status HTTP/1.0
Host: xxx.xxx.xxx.x
전송할 데이터의 바이트 수를 Python으로 계산합니다.
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> cmd = "GET /status HTTP/1.0\r\n"
>>> cmd += "Host: "
>>> cmd += "xxx.xxx.xxx.x"
>>> cmd += "\r\n\r\n"
>>> len(cmd)
45
AT+CIPSEND=45
명령에 요청의 바이트 수를 입력하면 >
가 표시됩니다.AT+CIPSEND=45 >
계속해서 앞서 파이썬에서 바이트 수를 계산한 요청 문자열을 입력합니다.
AT+CIPSEND=45 >
GET /status HTTP/1.0
Host: xxx.xxx.xxx.x
HTTP 요청을 제출하면 터미널에 응답이 표시됩니다. Mesublu 상태 JSON
{"meshblu":"online"}
가 표시되었습니다. SEND OK
+IPD,540:HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Content-Length: 20
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: close
Content-MD5: JSFOAmXDth0rK0AUCW8RBQ==
Date: Sun, 29 Mar 2015 09:23:40 GMT
Server: restify
Request-Id: 4807d360-daac-11e4-9cf7-a53c7accdff6
Response-Time: 2
{"meshblu":"online"}
OK
OK
Unlink
Reference
이 문제에 관하여(ESP8266을 USB-TTL 직렬 변환하여 Wi-Fi 확인), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/masato/items/a3b71f8a17b876be8f76텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)