Skip to content

Instantly share code, notes, and snippets.

@normandmickey
Created February 9, 2021 02:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save normandmickey/518219047cdb836d65dfcb1659229900 to your computer and use it in GitHub Desktop.
Save normandmickey/518219047cdb836d65dfcb1659229900 to your computer and use it in GitHub Desktop.
ESP32 Async Web Server for LNBits - LNURLp
#include "WiFi.h"
#include "ESPAsyncWebServer.h"
const char* ssid = "SSID";
const char* password = "PASSWORD";
AsyncWebServer server(80);
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
Serial.println(WiFi.localIP());
server.on(
"/post",
HTTP_POST,
[](AsyncWebServerRequest * request){},
NULL,
[](AsyncWebServerRequest * request, uint8_t *data, size_t len, size_t index, size_t total) {
for (size_t i = 0; i < len; i++) {
Serial.write(data[i]);
}
Serial.println();
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
request->send(200);
});
server.begin();
}
void loop() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment