@ brief Simplex communication with ESP8266 WiFi module using AT commands UART must be initialized and configured to use backchannel before using functions from this module.
ESP8266_UART must be defined in project_settings.h
Created on: March 18, 2019 Author: Stephen Glass
Example psuedo code: (Note the task scheduelr may need to be used to add delays between sending commands to ESP8266 because the device still needs to process it) void main() { UART_Init(); ESP8266_Reset(); ESP8266_SetMode(MODE_STATION, 0); ESP8266_ConnectNetwork("Rowan_IoT", "", 0); ESP8266_HTTP_GET("127.0.0.1", 80, "/api/callback.php", "?data=10"); }
#define MODE_SOFTAP_STATION 3 |
void ESP8266_ConnectNetwork |
( |
char * |
network_ssid, |
|
|
char * |
network_pass, |
|
|
uint8_t |
flash_settings |
|
) |
| |
Configure the WiFi network
- Parameters
-
network_ssid | name of the network SSID |
network_pass | password of the network |
flash_settings | flash the settings to the esp8266 (0, no; 1, flash) Setting to flash will automatically connect every time ESP8266 is powered on |
void ESP8266_HTTP_GET |
( |
char * |
hostname, |
|
|
int |
port, |
|
|
char * |
uri, |
|
|
char * |
payload |
|
) |
| const |
Performs a HTTP GET request on a specified URL with payload
- Parameters
-
hostname | hostname in format of IP address or URL (e.g 127.0.0.1, localhost) |
port | port of the HTTP server (default 80 on most servers) |
uri | uri of the server (e.g: /api/test.php) |
payload | payload to send (e.g: ?data=1&id=5) Helper function to calculate length of string |
s | string to calculate length |
void ESP8266_Reset |
( |
void |
| ) |
|
void ESP8266_SetMode |
( |
uint8_t |
mode, |
|
|
uint8_t |
flash_settings |
|
) |
| |
Set the mode of the ESP8266
- Parameters
-
mode | mode to set |
flash_settings | flash the setting to esp8266 (0, no; 1, flash) Setting to flash will automatically enable this mode every time ESP8266 is powered on |