Built-in project · Wemos LOLIN32 Lite

LOLIN32 Lite button

A pushbutton on GPIO 4 lights the LOLIN32 Lite’s blue LED on GPIO 22, which comes on when its pin is LOW. The whole build, a Wemos LOLIN32 Lite and 1 more part, 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.

Teaching? Assign it to your class in one click.

Beginner Runs in your browser. Free, and no account needed.

The parts retail for about $10.10. On Mokxi they're free.

LOLIN32 Lite button · Wemos LOLIN32 Litelive0.000 s 0.00x
Hold the button
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

The code

The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.

sketch.ino · Wemos LOLIN32 Lite
// Button: a pushbutton on 4 lights the blue LED on 22.
//
// INPUT_PULLUP switches on the pad's 45 k pull-up, so GPIO 4 sits at 3.3 V
// until the button pulls it to GND and reads LOW while it is held. The LED on
// GPIO 22 lights when that pin is LOW, so the pin simply copies the button.

const int BUTTON = 4;

void setup() {
  pinMode(BUTTON, INPUT_PULLUP);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, digitalRead(BUTTON));
  delay(5);
}

Parts list

3 parts, plus the jumper wires. They retail for about $10.10; on Mokxi they're free.

How it is wired

2 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.

  • Ground: Wemos LOLIN32 Lite pin GND; Pushbutton pin 2a; Pushbutton pin 2b
  • Wemos LOLIN32 Lite pin 4; Pushbutton pin 1a; Pushbutton pin 1b

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.