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@2:61ed6c1c9bdd, 2019-03-29 (annotated)
- Committer:
- EliasN
- Date:
- Fri Mar 29 09:12:39 2019 +0000
- Revision:
- 2:61ed6c1c9bdd
- Parent:
- 0:afba75b3b390
Add Access Point mode
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 | 2:61ed6c1c9bdd | 9 | Version: 1.0.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 | 2:61ed6c1c9bdd | 15 | ESPAT(PinName tx, PinName rx, int baud = 115200); |
EliasN | 0:afba75b3b390 | 16 | void resetEsp(); |
EliasN | 2:61ed6c1c9bdd | 17 | void initWifiStation(string ssid, string pwd); |
EliasN | 2:61ed6c1c9bdd | 18 | void initWifiAP(string ssid = "ESPAT", string pwd = "12345678", string channel = "5", string encryption = "3"); |
EliasN | 0:afba75b3b390 | 19 | void initServer(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 |