WeMos D1 Wifi Uno ESP8266 esp-12e [B175]



https://www.youtube.com/watch?v=WS91LpeA6QM


*GitHubhttps://github.com/rdiot/rdiot-b175.git


* Specs

Microcontroller ESP-8266EX

Operating Voltage 3.3V

Digital I/O Pins 11

Analog Input Pins 1(Max input: 3.2V)

Clock Speed 80MHz/160MHz

Flash 4M bytes

Length 68.6mm

Width 53.4mm

Weight 25g

OTA -- Wireless Upload(Program)

On board switching power supply -- Max 24V input, 5V 1A output

Support Ard uino IDE


Pin Function ESP-8266 Pin

TX TXD TXD

RX RXD RXD

A0 Analog input, max 3.3V input A0

D0 IO GPIO16

D1 IO, SCL GPIO5

D2 IO, SDA GPIO4

D3 IO, 10k Pull-up GPIO0

D4 IO, 10k Pull-up, BUILTIN_LED GPIO2

D5 IO, SCK GPIO14

D6 IO, MISO GPIO12

D7 IO, MOSI GPIO13

D8 IO, 10k Pull-down, SS GPIO15

G Ground GND

5V 5V -

3V3 3.3V 3.3V

RST Reset RST


* Contents

- Board Setup

http://arduino.esp8266.com/versions/2.3.0/package_esp8266com_index.json


- WebMos XI

https://www.wemos.cc/tutorial/getting-started-wemos-xi.html

https://github.com/wemos/Arduino_XI/archive/master.zip


- Key Code (example : helloServer)

#include <ESP8266WiFi.h>

#include <WiFiClient.h>

#include <ESP8266WebServer.h>

#include <ESP8266mDNS.h>

 

const char* ssid = "AP-B-2.4G";

const char* password = "32903290";

 

ESP8266WebServer server(80);

 

const int led = 13;

 

void handleRoot() {

  digitalWrite(led, 1);

  server.send(200, "text/plain", "hello RDIoT Wemos D1 Server Test from esp8266!");

  digitalWrite(led, 0);

}

 

void handleNotFound(){

  digitalWrite(led, 1);

  String message = "File Not Found\n\n";

  message += "URI: ";

  message += server.uri();

  message += "\nMethod: ";

  message += (server.method() == HTTP_GET)?"GET":"POST";

  message += "\nArguments: ";

  message += server.args();

  message += "\n";

  for (uint8_t i=0; i<server.args(); i++){

    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";

  }

  server.send(404, "text/plain", message);

  digitalWrite(led, 0);

}

 

void setup(void){

  pinMode(led, OUTPUT);

  digitalWrite(led, 0);

  Serial.begin(115200);

  WiFi.begin(ssid, password);

  Serial.println("");

 

  // Wait for connection

  while (WiFi.status() != WL_CONNECTED) {

    delay(500);

    Serial.print(".");

  }

  Serial.println("");

  Serial.print("Connected to ");

  Serial.println(ssid);

  Serial.print("IP address: ");

  Serial.println(WiFi.localIP());

 

  if (MDNS.begin("esp8266")) {

    Serial.println("MDNS responder started");

  }

 

  server.on("/", handleRoot);

 

  server.on("/rdiot", [](){

    server.send(200, "text/plain", "Hi I'm RD IoT...");

  });

 

  server.onNotFound(handleNotFound);

 

  server.begin();

  Serial.println("HTTP server started");

}

 

void loop(void){

  server.handleClient();

}

Posted by RDIoT
|