Wemos D1 Mini – Pinout and Setup
FunduinoPublished on
Pinbelegung, Bussysteme, WLAN und die Einrichtung in der Arduino IDE
You need this
0.96-inch OLED display - 128x64 pixels, I2C, SSD1306
4,62 € *Item no. FUN-1010561About the product — 0.96-inch OLED display - 128x64 pixels, I2C, SSD1306
LCD Module 20x4 - I2C, Blue Backlight, 3.3-5 V
6,21 € *Item no. F23107181About the product — LCD Module 20x4 - I2C, Blue Backlight, 3.3-5 V
DS3231 RTC module - real-time clock with I2C, 3.3-5.5 V
5,10 € *Item no. F23106657About the product — DS3231 RTC module - real-time clock with I2C, 3.3-5.5 V
D1 Mini microcontroller - Wi-Fi, Bluetooth LE, Micro-USB
4,57 € *Item no. F23107825About the product — D1 Mini microcontroller - Wi-Fi, Bluetooth LE, Micro-USB
All 4 parts together 20,50 € *
* All prices include statutory VAT, plus shipping costs.
What the Wemos D1 Mini can do
1 / 2
The I²C pins
The SPI pins
The digital pins
1 / 2
Blink program for an LED on D8
int LED = D8;
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(1000);
}The analog pin
1 / 2
Read the potentiometer on pin A0
// Potentiometer an Pin A0
int Potentiometer = A0;
// Variable für den gelesenen Wert
int GelesenerWert = 0;
void setup()
{
Serial.begin(9600);
delay(1000);
}
void loop()
{
// analogen Wert lesen
GelesenerWert = analogRead(Potentiometer);
Serial.println(GelesenerWert);
delay(500);
}Wi-Fi example: Random numbers in the browser
1 / 2
Wi-Fi example: Display random numbers in the browser
#include "ESP8266WiFi.h"
// Router SSID and password
char Router[] = "Router_SSID";
char Passwort[] = "xxxxxxxx";
WiFiServer Server(80);
WiFiClient Client;
// Minimum and maximum random numbers
int Minimum = 1;
int Maximum = 49;
void setup()
{
Serial.begin(9600);
// Wait for serial connection
while (!Serial);
// Start WiFi
WiFi.begin(Router, Passwort);
// Establish connection
while (WiFi.status() != WL_CONNECTED)
{
delay(200);
Serial.print(".");
}
Server.begin();
// Display router SSID
Serial.println();
Serial.print("Connected to ");
Serial.println(WiFi.SSID());
// Display IP
Serial.println(WiFi.localIP());
// Start random number generator with the signal on A0
randomSeed(analogRead(0));
}
void loop()
{
Client = Server.available();
if (Client)
{
// Build page when SeiteAufbauen is true
boolean SeiteAufbauen = true;
// As long as the client is connected ...
while (Client.connected())
{
if (Client.available())
{
// Read request from client ...
char Zeichen = Client.read();
// Return (\n) sent
if (Zeichen == '\n')
{
// If SeiteAufbauen has the value true
if (SeiteAufbauen)
{
/*
Build HTML page.
The following statements must be sent with print or println.
println "beautifies" the source code by adding a line break
to the source code.
*/
Client.println("HTTP/1.1 200 OK");
Client.println("Content-type:text/html");
// Blank line is required
Client.println();
Client.println("<!doctype html>");
Client.println("<html>");
Client.println("<body>");
// Refresh every 60 seconds with a meta tag
Client.println("<meta http-equiv=\"refresh\" content=\"60\">");
// <h2> Heading H2
Client.println("<h2>Random numbers</h2>");
// <hr> horizontal line
Client.println("<hr>");
// Display random numbers
for (int i = 0; i < 7; i++)
{
int Zahl = random(Minimum, Maximum);
Client.println(Zahl);
Client.println(" ");
}
Client.print("<hr>");
// Display IPs
Client.print("Own IP (server): ");
Client.print(Client.remoteIP());
// <br> break = new line
Client.print("<br>Client DHCP IP address ");
Client.print(WiFi.localIP());
// Close the page
Client.println("</h2></body>");
Client.println("</html>");
// HTTP response ends with a new line
Client.println();
// Page fully loaded -> exit loop
break;
}
// If a new line (\n) was sent -> build the page
if (Zeichen == '\n') SeiteAufbauen = true;
else if (Zeichen != '\r') SeiteAufbauen = false;
delay(1);
Client.stop();
}
}
}
}
}Install and select the board
1 / 4
Rate the instructions