|
|
@ -4,6 +4,7 @@ |
|
|
|
#include <ESPAsyncWebServer.h>
|
|
|
|
#include <AsyncElegantOTA.h>
|
|
|
|
#include <Wire.h>
|
|
|
|
#include <LiquidCrystal.h>
|
|
|
|
|
|
|
|
AsyncWebServer server(80); |
|
|
|
|
|
|
@ -32,12 +33,45 @@ const char index_html[] PROGMEM = R"rawliteral( |
|
|
|
|
|
|
|
</body></html>)rawliteral"; |
|
|
|
|
|
|
|
// LCD pins <--> ESP8266 LOLIN D1 pins
|
|
|
|
const int e_RS = 4, e_EN = 5, e_D4 = 12, e_D5 = 13, e_D6 = 14, e_D7 = 15; |
|
|
|
LiquidCrystal lcd(e_RS, e_EN, e_D4, e_D5, e_D6, e_D7); |
|
|
|
|
|
|
|
// Custom character matrix (coffee cup left side)
|
|
|
|
byte cupL[8] = {0b00001,0b00010,0b00010,0b00001,0b00001,0b00000,0b00111,0b00100}; |
|
|
|
// Custom character matrix (coffee cup center)
|
|
|
|
byte cupC[8] = {0b00100,0b00101,0b01001,0b01000,0b00100,0b00000,0b11111,0b00000}; |
|
|
|
// Custom character matrix (coffee cup right side)
|
|
|
|
byte cupR[8] = {0b10000,0b00000,0b00000,0b10000,0b10000,0b00000,0b11000,0b01110}; |
|
|
|
// Custom character matrix (coffee cup left side line 2)
|
|
|
|
byte cupL1[8] = {0b00100,0b00100,0b00100,0b00010,0b01111,0b01000,0b00111,0b00000}; |
|
|
|
// Custom character matrix (coffee cup center line 2)
|
|
|
|
byte cupC1[8] = {0b00000,0b00000,0b00000,0b00000,0b11111,0b00000,0b11111,0b00000}; |
|
|
|
// Custom character matrix (coffee cup right side line 2)
|
|
|
|
byte cupR1[8] = {0b01010,0b01010,0b01110,0b10000,0b11100,0b00100,0b11000,0b00000}; |
|
|
|
|
|
|
|
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) { |
|
|
|
// initialize serial:
|
|
|
|
Serial.begin(9600); |
|
|
|
|
|
|
|
// Make custom characters available to LCD
|
|
|
|
lcd.createChar(0, cupL); |
|
|
|
lcd.createChar(1, cupC); |
|
|
|
lcd.createChar(2, cupR); |
|
|
|
lcd.createChar(3, cupL1); |
|
|
|
lcd.createChar(4, cupC1); |
|
|
|
lcd.createChar(5, cupR1); |
|
|
|
lcd.begin(16, 2); // set up number of columns and rows
|
|
|
|
lcd.clear(); // Clear LCD
|
|
|
|
// this part is for testing and boot messages only
|
|
|
|
lcd.setCursor(0, 0); // move cursor to (0, 0)
|
|
|
|
lcd.print("PyCoffee_WiFi"); |
|
|
|
|
|
|
|
WiFi.mode(WIFI_STA); |
|
|
|
// WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE);
|
|
|
|
WiFi.setHostname(hostname.c_str()); //define hostname
|
|
|
@ -57,5 +91,19 @@ void setup(void) { |
|
|
|
|
|
|
|
// the loop function runs over and over again forever
|
|
|
|
void loop() { |
|
|
|
|
|
|
|
delay(1000); |
|
|
|
lcd.clear(); // Clear LCD at every cycle
|
|
|
|
lcd.setCursor(0, 0); // move cursor to (0, 0)
|
|
|
|
lcd.print("Test"); |
|
|
|
lcd.setCursor(0, 1); // move cursor to (0, 0)
|
|
|
|
lcd.print("V ALPHA 0.1"); |
|
|
|
delay(1000); |
|
|
|
lcd.setCursor(12,0); //print using uint8 method
|
|
|
|
lcd.write((uint8_t)0); |
|
|
|
lcd.write((uint8_t)1); |
|
|
|
lcd.write((uint8_t)2); |
|
|
|
lcd.setCursor(12,1); //print using uint8 method
|
|
|
|
lcd.write((uint8_t)3); |
|
|
|
lcd.write((uint8_t)4); |
|
|
|
lcd.write((uint8_t)5); |
|
|
|
} |