DE: Ein sehr, sehr einfacher Webserver mithilfe eines ESP8266 auf dem die AT-Firmware läuft . Für Bulme Bertl. - EN: A very, very, basic web server that works using an ESP8266 running the AT-Firmware.

Dependents:   BULME_BERTL17_WebServer_ESPAT Bravo Team

Click here for example code!

DE:

Ein sehr, sehr einfacher Webserver mithilfe eines ESP8266 auf dem die AT-Firmware läuft. Getestet mit einem ESP-01 Modul am Bulme Bertl 2017 (LPC11U68).

EN:

A very, very, basic web server that works using an ESP8266 running the AT-Firmware. Tested with an ESP-01 Module and Bulme Bertl 2017 (LPC11U68).

ESPAT.h

Committer:
EliasN
Date:
2019-03-29
Revision:
2:61ed6c1c9bdd
Parent:
0:afba75b3b390

File content as of revision 2:61ed6c1c9bdd:

#ifndef ESPAT_H
#define ESPAT_H

#include "mbed.h"
#include "string"

/*
Library for using an ESP8266 (e.g. ESP-01 board) with its AT command firmware as webserver
Version: 1.0.0
(C)2019 Elias Nestl
*/

class ESPAT {
public:
    ESPAT(PinName tx, PinName rx, int baud = 115200);
    void resetEsp();
    void initWifiStation(string ssid, string pwd);
    void initWifiAP(string ssid = "ESPAT", string pwd = "12345678", string channel = "5", string encryption = "3");
    void initServer(void (*requestHandler)(int, string));
    void tcpReply(int linkId, string data);
    void httpReply(int linkId, string code, string payload);
private:
    Serial espSerial;
    string wifiName;
    string wifiPass;
    void readStrUntil(string * str, char until);
    void waitFor(char * text);
    void sendCommand(char * cmd, bool waitOk = true);
};

#endif