D1 mini blink
The module’s blue LED on D4 lights when the pin is low and an LED on D1 when it is high, so the two are always opposite. The whole build, a Wemos D1 mini and 2 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Runs in your browser. Free, and no account needed.
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// Blink: the module's own LED on D4, and an LED you wire yourself on D1.
//
// The LED on an ESP-12 module is GPIO2, which the NodeMCU silkscreen calls D4,
// and it is active low: LOW lights it. The wired one on D1 is the ordinary way
// round, so the two are always opposite.
const int kLed = LED_BUILTIN; // GPIO2, D4, active low
const int kWired = D1; // GPIO5, an LED and a resistor to ground
void setup()
{
pinMode(kLed, OUTPUT);
pinMode(kWired, OUTPUT);
}
void loop()
{
digitalWrite(kLed, LOW); // lit
digitalWrite(kWired, HIGH);
delay(500);
digitalWrite(kLed, HIGH); // dark
digitalWrite(kWired, LOW);
delay(500);
}
Parts list
4 parts, plus the jumper wires. Every one is in the editor's parts bin.
- 1 × Wemos D1 mini
- 1 × Full-size breadboard
- 1 × Resistor, 220 Ω
- 1 × LED, red
How it is wired
3 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Wemos D1 mini pin D1; Resistor, 220 Ω pin 1
- Ground: Wemos D1 mini pin GND; LED, red pin C
- Resistor, 220 Ω pin 2; LED, red pin A
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.