Browse Source

added initial code, empty

master
studentidisinistra 1 year ago
parent
commit
326a7c5cd8
2 changed files with 70 additions and 0 deletions
  1. +61
    -0
      PyCoffeeESP8266/PyCoffeeESP8266.ino
  2. +9
    -0
      PyCoffeeNano/PyCoffeeNano.ino

+ 61
- 0
PyCoffeeESP8266/PyCoffeeESP8266.ino View File

@ -0,0 +1,61 @@
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>
#include <Wire.h>
AsyncWebServer server(80);
// WiFi settings
const char* ssid = "LILiK_WiFi"; //replace with your SSID
const char* password = "pippopippo"; //password
String hostname = "PyCoffee";
// HTML WEB interface
const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html><head>
<title>PyCoffee HTML interface</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head><body>
<h2>Ciao! Sono l'ESP8266 che gestisce la PyCoffee!</h2>
<style>
html {font-family: Times New Roman; display: inline-block; text-align: center;}
h2 {font-size: 2.0rem;}
h3 {font-size: 2.0rem; color: #FF0000;}
</style>
<h2>Clicca qui sotto per aggiornare il firmware, o il secondo link per il sorgente.</h2>
<a href='/update'>&#11014;&#65039; OTA Firmware_Update &#11014;&#65039;</a>
<a href='https://projects.lilik.it/LILiK/PyCoffee_ESP8266'>&#9749;Gitea&#9749;</a><br><br>
</body></html>)rawliteral";
void notFound(AsyncWebServerRequest *request) {
request->send(404, "text/plain", "Not found");
}
// the setup function runs once when you press reset or power the board
void setup(void) {
WiFi.mode(WIFI_STA);
// WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE);
WiFi.setHostname(hostname.c_str()); //define hostname
WiFi.begin(ssid, password);
// Send web page with input fields to client
server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
request->send(200, "text/html", index_html);
});
server.onNotFound(notFound);
AsyncElegantOTA.begin(&server); // Start ElegantOTA
server.begin();
Serial.println("HTTP server started");
}
// the loop function runs over and over again forever
void loop() {
}

+ 9
- 0
PyCoffeeNano/PyCoffeeNano.ino View File

@ -0,0 +1,9 @@
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}

Loading…
Cancel
Save