ESP-WROOM-02/ESP8266 LED 치카치카
14021 단어 ledESP8266다른 R전자 공작ESP-WROOM-02
· 필요한 것
솔더도 한 적이 없지만 ESP-WROOM-02를 사 보았습니다.
어떤 것을 사도 좋은지도 모른다. . . 아래 사이트 참고로하겠습니다.
Eleclog
※매우 참고가 됩니다. 공부가 됩니다.
필자가 작성한 AKIcart! (대단히 편리)
"ESP-WROOM-02로 미니멀한 IRKit 클론을 만든다"의 AKICart가 "공개"가 되어 있기 때문에
그대로 붙여 드립니다.
■ 적외선 송수신을위한 세트로 다음을 구입 (전부 사두면 틀림없음)
ESP-WROOM-02로 최소한의 IRKit 클론 만들기 (AKIcart)

650엔으로 염가이므로, 4개 정도 사 봤습니다.
■ 시리얼 통신을 위해 구입
ESP8266에 프로그램을 작성하기 위해 직렬 인터페이스 모듈도 함께 구입했습니다.
microUSB로부터 전력도 공급 가능이라는 것으로.
FT231X USB 직렬 변환 모듈
750엔 의외로 높음
■LED 치카치카를 위해 구입
LED를 빛내기 위해 다음을 구입했습니다.
고휘도 5mm 적색 LED 7cd 60도(10개입)
10개로 150엔 싸다
・솔더
준비한 것
링크
가격
코멘트
goot 전자 공작용 납땜 인두 세트 X-2000E
goot 전자 공작용 납땜 인두 세트 X-2000E
1409엔
아마존에서 구매
여러가지 붙어 있으므로, 상기의 세트 샀습니다.

안의 핀은 좌기와 같이 했습니다만, 맞는지 모르겠습니다.

처음이면서, 완성되었으므로 일안심. . 그런데 까맣지만. .

이쪽은 시리얼
· 브레드 보드에 연결 · 배선도
브레드보드에 연결해 봅니다.
gpio에서 출력시켜 LED 빛나게 해 봅니다.

※연결 방법은 적당하므로 미안해
※저항 몇개인가 잊었습니다. . .
· 프로그램
선인의 선배님의 프로그램을 참고로 했습니다.
WiFiWebServer.ino/*
* This sketch demonstrates how to set up a simple HTTP-like server.
* The server will set a GPIO pin depending on the request
* http://server_ip/gpio/0 will set the GPIO2 low,
* http://server_ip/gpio/1 will set the GPIO2 high
* server_ip is the IP address of the ESP8266 module, will be
* printed to Serial when the module is connected.
*/
#include <ESP8266WiFi.h>
const char* ssid = "your-ssid";
const char* password = "your-password";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
Serial.begin(115200);
delay(10);
// prepare GPIO2
pinMode(2, OUTPUT);
digitalWrite(2, 0);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println("new client");
while(!client.available()){
delay(1);
}
// Read the first line of the request
String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();
// Match the request
int val;
if (req.indexOf("/gpio/0") != -1)
val = 0;
else if (req.indexOf("/gpio/1") != -1)
val = 1;
else {
Serial.println("invalid request");
client.stop();
return;
}
// Set GPIO2 according to the request
digitalWrite(2, val);
client.flush();
// Prepare the response
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nGPIO is now ";
s += (val)?"high":"low";
s += "</html>\n";
// Send the response to the client
client.print(s);
delay(1);
Serial.println("Client disonnected");
// The client will actually be disconnected
// when the function returns and 'client' object is detroyed
}
품목
변경 부분
코멘트
■GPIO 관련
//prepare GPIO2pinMode(4, OUTPUT);digitalWrite(4, 0);//Set GPIO2 according to the request digitalWrite(4, val);
출력하는 GPIO를 변경. 이번에는 2에서 4로 변경하고 있습니다.
■SSID 관련
const char* ssid="your-ssid";const char* password="your-password";
자신의 환경에 맞게
· ESP8266에 쓰기
Arduino IDE를 설치하고 씁니다.
Arduino 사용법은 조사하면 바로 나오므로 할애합니다.

RST와 GND를 연결하면 왼쪽과 같은 문자가 출력됩니다. 그런 다음 연결된 점퍼 코드를 뽑습니다.

쓰기 끝나고

왼쪽과 같이 얻은 IP 주소가 표시되면 OK

브라우저에서 http://표시된 IP/gpio/1에 액세스하면

지정된 GPIO에서 출력하여 LED가 빛납니다! (감동...) 반대로/gpio/0 에 액세스하면 LED가 꺼진다는 것입니다.
· 결론
단순한 LED 치카치카였지만, 꿈이 퍼졌습니다+전자 공작의 즐거움을 다시 한번 느꼈습니다.
만들어진 것을 괴롭히는 것과 만든 것을 괴롭히는 것은 전혀 다릅니다.
Reference
이 문제에 관하여(ESP-WROOM-02/ESP8266 LED 치카치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/engksk/items/16f1ac61eedcbb4dfaa8
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
준비한 것
링크
가격
코멘트
goot 전자 공작용 납땜 인두 세트 X-2000E
goot 전자 공작용 납땜 인두 세트 X-2000E
1409엔
아마존에서 구매
여러가지 붙어 있으므로, 상기의 세트 샀습니다.

안의 핀은 좌기와 같이 했습니다만, 맞는지 모르겠습니다.

처음이면서, 완성되었으므로 일안심. . 그런데 까맣지만. .

이쪽은 시리얼
· 브레드 보드에 연결 · 배선도
브레드보드에 연결해 봅니다.
gpio에서 출력시켜 LED 빛나게 해 봅니다.

※연결 방법은 적당하므로 미안해
※저항 몇개인가 잊었습니다. . .
· 프로그램
선인의 선배님의 프로그램을 참고로 했습니다.
WiFiWebServer.ino/*
* This sketch demonstrates how to set up a simple HTTP-like server.
* The server will set a GPIO pin depending on the request
* http://server_ip/gpio/0 will set the GPIO2 low,
* http://server_ip/gpio/1 will set the GPIO2 high
* server_ip is the IP address of the ESP8266 module, will be
* printed to Serial when the module is connected.
*/
#include <ESP8266WiFi.h>
const char* ssid = "your-ssid";
const char* password = "your-password";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
Serial.begin(115200);
delay(10);
// prepare GPIO2
pinMode(2, OUTPUT);
digitalWrite(2, 0);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println("new client");
while(!client.available()){
delay(1);
}
// Read the first line of the request
String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();
// Match the request
int val;
if (req.indexOf("/gpio/0") != -1)
val = 0;
else if (req.indexOf("/gpio/1") != -1)
val = 1;
else {
Serial.println("invalid request");
client.stop();
return;
}
// Set GPIO2 according to the request
digitalWrite(2, val);
client.flush();
// Prepare the response
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nGPIO is now ";
s += (val)?"high":"low";
s += "</html>\n";
// Send the response to the client
client.print(s);
delay(1);
Serial.println("Client disonnected");
// The client will actually be disconnected
// when the function returns and 'client' object is detroyed
}
품목
변경 부분
코멘트
■GPIO 관련
//prepare GPIO2pinMode(4, OUTPUT);digitalWrite(4, 0);//Set GPIO2 according to the request digitalWrite(4, val);
출력하는 GPIO를 변경. 이번에는 2에서 4로 변경하고 있습니다.
■SSID 관련
const char* ssid="your-ssid";const char* password="your-password";
자신의 환경에 맞게
· ESP8266에 쓰기
Arduino IDE를 설치하고 씁니다.
Arduino 사용법은 조사하면 바로 나오므로 할애합니다.

RST와 GND를 연결하면 왼쪽과 같은 문자가 출력됩니다. 그런 다음 연결된 점퍼 코드를 뽑습니다.

쓰기 끝나고

왼쪽과 같이 얻은 IP 주소가 표시되면 OK

브라우저에서 http://표시된 IP/gpio/1에 액세스하면

지정된 GPIO에서 출력하여 LED가 빛납니다! (감동...) 반대로/gpio/0 에 액세스하면 LED가 꺼진다는 것입니다.
· 결론
단순한 LED 치카치카였지만, 꿈이 퍼졌습니다+전자 공작의 즐거움을 다시 한번 느꼈습니다.
만들어진 것을 괴롭히는 것과 만든 것을 괴롭히는 것은 전혀 다릅니다.
Reference
이 문제에 관하여(ESP-WROOM-02/ESP8266 LED 치카치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/engksk/items/16f1ac61eedcbb4dfaa8
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
선인의 선배님의 프로그램을 참고로 했습니다.
WiFiWebServer.ino
/*
* This sketch demonstrates how to set up a simple HTTP-like server.
* The server will set a GPIO pin depending on the request
* http://server_ip/gpio/0 will set the GPIO2 low,
* http://server_ip/gpio/1 will set the GPIO2 high
* server_ip is the IP address of the ESP8266 module, will be
* printed to Serial when the module is connected.
*/
#include <ESP8266WiFi.h>
const char* ssid = "your-ssid";
const char* password = "your-password";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
Serial.begin(115200);
delay(10);
// prepare GPIO2
pinMode(2, OUTPUT);
digitalWrite(2, 0);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println("new client");
while(!client.available()){
delay(1);
}
// Read the first line of the request
String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();
// Match the request
int val;
if (req.indexOf("/gpio/0") != -1)
val = 0;
else if (req.indexOf("/gpio/1") != -1)
val = 1;
else {
Serial.println("invalid request");
client.stop();
return;
}
// Set GPIO2 according to the request
digitalWrite(2, val);
client.flush();
// Prepare the response
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nGPIO is now ";
s += (val)?"high":"low";
s += "</html>\n";
// Send the response to the client
client.print(s);
delay(1);
Serial.println("Client disonnected");
// The client will actually be disconnected
// when the function returns and 'client' object is detroyed
}
품목
변경 부분
코멘트
■GPIO 관련
//prepare GPIO2pinMode(4, OUTPUT);digitalWrite(4, 0);//Set GPIO2 according to the request digitalWrite(4, val);
출력하는 GPIO를 변경. 이번에는 2에서 4로 변경하고 있습니다.
■SSID 관련
const char* ssid="your-ssid";const char* password="your-password";
자신의 환경에 맞게
· ESP8266에 쓰기
Arduino IDE를 설치하고 씁니다.
Arduino 사용법은 조사하면 바로 나오므로 할애합니다.

RST와 GND를 연결하면 왼쪽과 같은 문자가 출력됩니다. 그런 다음 연결된 점퍼 코드를 뽑습니다.

쓰기 끝나고

왼쪽과 같이 얻은 IP 주소가 표시되면 OK

브라우저에서 http://표시된 IP/gpio/1에 액세스하면

지정된 GPIO에서 출력하여 LED가 빛납니다! (감동...) 반대로/gpio/0 에 액세스하면 LED가 꺼진다는 것입니다.
· 결론
단순한 LED 치카치카였지만, 꿈이 퍼졌습니다+전자 공작의 즐거움을 다시 한번 느꼈습니다.
만들어진 것을 괴롭히는 것과 만든 것을 괴롭히는 것은 전혀 다릅니다.
Reference
이 문제에 관하여(ESP-WROOM-02/ESP8266 LED 치카치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/engksk/items/16f1ac61eedcbb4dfaa8
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
단순한 LED 치카치카였지만, 꿈이 퍼졌습니다+전자 공작의 즐거움을 다시 한번 느꼈습니다.
만들어진 것을 괴롭히는 것과 만든 것을 괴롭히는 것은 전혀 다릅니다.
Reference
이 문제에 관하여(ESP-WROOM-02/ESP8266 LED 치카치카), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/engksk/items/16f1ac61eedcbb4dfaa8텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)