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@0:afba75b3b390, 2019-02-18 (annotated)
- Committer:
- EliasN
- Date:
- Mon Feb 18 21:31:03 2019 +0000
- Revision:
- 0:afba75b3b390
- Child:
- 2:61ed6c1c9bdd
Publish ESPAT library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EliasN | 0:afba75b3b390 | 1 | #ifndef ESPAT_H |
EliasN | 0:afba75b3b390 | 2 | #define ESPAT_H |
EliasN | 0:afba75b3b390 | 3 | |
EliasN | 0:afba75b3b390 | 4 | #include "mbed.h" |
EliasN | 0:afba75b3b390 | 5 | #include "string" |
EliasN | 0:afba75b3b390 | 6 | |
EliasN | 0:afba75b3b390 | 7 | /* |
EliasN | 0:afba75b3b390 | 8 | Library for using an ESP8266 (e.g. ESP-01 board) with its AT command firmware as webserver |
EliasN | 0:afba75b3b390 | 9 | Version: 0.1.0 |
EliasN | 0:afba75b3b390 | 10 | (C)2019 Elias Nestl |
EliasN | 0:afba75b3b390 | 11 | */ |
EliasN | 0:afba75b3b390 | 12 | |
EliasN | 0:afba75b3b390 | 13 | class ESPAT { |
EliasN | 0:afba75b3b390 | 14 | public: |
EliasN | 0:afba75b3b390 | 15 | ESPAT(PinName tx, PinName rx, string wifiName, string wifiPass, int baud = 115200); |
EliasN | 0:afba75b3b390 | 16 | void resetEsp(); |
EliasN | 0:afba75b3b390 | 17 | void initWifi(); |
EliasN | 0:afba75b3b390 | 18 | void initServer(void (*requestHandler)(int, string)); |
EliasN | 0:afba75b3b390 | 19 | void startWebServer(void (*readyCallback)(), void (*requestHandler)(int, string)); |
EliasN | 0:afba75b3b390 | 20 | void tcpReply(int linkId, string data); |
EliasN | 0:afba75b3b390 | 21 | void httpReply(int linkId, string code, string payload); |
EliasN | 0:afba75b3b390 | 22 | private: |
EliasN | 0:afba75b3b390 | 23 | Serial espSerial; |
EliasN | 0:afba75b3b390 | 24 | string wifiName; |
EliasN | 0:afba75b3b390 | 25 | string wifiPass; |
EliasN | 0:afba75b3b390 | 26 | void readStrUntil(string * str, char until); |
EliasN | 0:afba75b3b390 | 27 | void waitFor(char * text); |
EliasN | 0:afba75b3b390 | 28 | void sendCommand(char * cmd, bool waitOk = true); |
EliasN | 0:afba75b3b390 | 29 | }; |
EliasN | 0:afba75b3b390 | 30 | |
EliasN | 0:afba75b3b390 | 31 | #endif |