![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
OneNet_IoT_demo for ASC platform
Dependencies: Common_lib ESP8266 EdpKit_lib cJSON_lib driver_mbed_HP20x driver_mbed_TH02 wifi_example
Fork of mbed-os-example-esp8266 by
README.md@1:b4a718e62e0b, 2017-01-12 (annotated)
- Committer:
- sarahmarshy
- Date:
- Thu Jan 12 22:05:15 2017 +0000
- Revision:
- 1:b4a718e62e0b
- Parent:
- 0:b887535f68bf
Update esp8266-driver
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-ESP8266 | 0:b887535f68bf | 1 | # mbed-os-example-wifi # |
group-ESP8266 | 0:b887535f68bf | 2 | |
group-ESP8266 | 0:b887535f68bf | 3 | WiFi example for mbed OS |
group-ESP8266 | 0:b887535f68bf | 4 | |
group-ESP8266 | 0:b887535f68bf | 5 | ## Getting started with the WiFi API ## |
group-ESP8266 | 0:b887535f68bf | 6 | |
group-ESP8266 | 0:b887535f68bf | 7 | This is a quick example of a simple WiFi application using the WiFi and network-socket APIs that is provided as a part of [mbed-os](github.com/armmbed/mbed-os). |
group-ESP8266 | 0:b887535f68bf | 8 | |
group-ESP8266 | 0:b887535f68bf | 9 | The program brings up the WiFi and the underlying network interface, and uses it to scans available networks, connects to a network, prints interface and connection details and performs simple HTTP operation. |
group-ESP8266 | 0:b887535f68bf | 10 | |
group-ESP8266 | 0:b887535f68bf | 11 | ### Supported hardware ### |
group-ESP8266 | 0:b887535f68bf | 12 | |
group-ESP8266 | 0:b887535f68bf | 13 | * [UBLOX Odin board](https://developer.mbed.org/platforms/ublox-EVK-ODIN-W2/) (`UBLOX_EVK_ODIN_W2` target when using mbed CLI) |
group-ESP8266 | 0:b887535f68bf | 14 | * Other mbed target with ESP2866 module (Board it's connected to shouldn't have other network interface eg. Ethernet) |
group-ESP8266 | 0:b887535f68bf | 15 | |
group-ESP8266 | 0:b887535f68bf | 16 | ESP2866 is a fallback option and will be used if the build is for unsupported platform. |
group-ESP8266 | 0:b887535f68bf | 17 | |
group-ESP8266 | 0:b887535f68bf | 18 | #### Connecting the ESP2866 #### |
group-ESP8266 | 0:b887535f68bf | 19 | |
group-ESP8266 | 0:b887535f68bf | 20 | ESP module needs to be connected to RX and TX UART pins (+ power and ground) on your target board. That can be achieved using Grove shield or connected directly using jumper wires, please note that not all Arduino form factor boards have UART compatible with the Grove shiled. |
group-ESP8266 | 0:b887535f68bf | 21 | |
group-ESP8266 | 0:b887535f68bf | 22 | For Grove shield TX has to be connected to D1 and RX to D0. |
group-ESP8266 | 0:b887535f68bf | 23 | |
group-ESP8266 | 0:b887535f68bf | 24 | Make sure that UART module you're connecting ESP to is different than the debug UART connected to your USB port. |
group-ESP8266 | 0:b887535f68bf | 25 | |
group-ESP8266 | 0:b887535f68bf | 26 | ## Getting started |
group-ESP8266 | 0:b887535f68bf | 27 | |
group-ESP8266 | 0:b887535f68bf | 28 | 1. Import the example |
group-ESP8266 | 0:b887535f68bf | 29 | |
group-ESP8266 | 0:b887535f68bf | 30 | ``` |
group-ESP8266 | 0:b887535f68bf | 31 | mbed import mbed-os-example-wifi |
group-ESP8266 | 0:b887535f68bf | 32 | cd mbed-os-example-wifi |
group-ESP8266 | 0:b887535f68bf | 33 | ``` |
group-ESP8266 | 0:b887535f68bf | 34 | 2. Configure the WiFi credentials |
group-ESP8266 | 0:b887535f68bf | 35 | |
group-ESP8266 | 0:b887535f68bf | 36 | Edit ```mbed_app.json``` to include correct SSID and Password: |
group-ESP8266 | 0:b887535f68bf | 37 | |
group-ESP8266 | 0:b887535f68bf | 38 | ``` |
group-ESP8266 | 0:b887535f68bf | 39 | "config": { |
group-ESP8266 | 0:b887535f68bf | 40 | "wifi-ssid": { |
group-ESP8266 | 0:b887535f68bf | 41 | "help": "WiFi SSID", |
group-ESP8266 | 0:b887535f68bf | 42 | "value": "\"SSID\"" |
group-ESP8266 | 0:b887535f68bf | 43 | }, |
group-ESP8266 | 0:b887535f68bf | 44 | "wifi-password": { |
group-ESP8266 | 0:b887535f68bf | 45 | "help": "WiFi Password", |
group-ESP8266 | 0:b887535f68bf | 46 | "value": "\"Password\"" |
group-ESP8266 | 0:b887535f68bf | 47 | } |
group-ESP8266 | 0:b887535f68bf | 48 | }, |
group-ESP8266 | 0:b887535f68bf | 49 | ``` |
group-ESP8266 | 0:b887535f68bf | 50 | |
group-ESP8266 | 0:b887535f68bf | 51 | 3. Compile and generate binary |
group-ESP8266 | 0:b887535f68bf | 52 | |
group-ESP8266 | 0:b887535f68bf | 53 | For example, for `GCC`: |
group-ESP8266 | 0:b887535f68bf | 54 | |
group-ESP8266 | 0:b887535f68bf | 55 | ``` |
group-ESP8266 | 0:b887535f68bf | 56 | mbed compile -t GCC_ARM -m UBLOX_EVK_ODIN_W2 |
group-ESP8266 | 0:b887535f68bf | 57 | ``` |
group-ESP8266 | 0:b887535f68bf | 58 | |
group-ESP8266 | 0:b887535f68bf | 59 | ## Documentation ## |
group-ESP8266 | 0:b887535f68bf | 60 | |
group-ESP8266 | 0:b887535f68bf | 61 | More information on the network-socket API can be found in the [mbed handbook](https://docs.mbed.com/docs/mbed-os-api-reference/en/5.2/APIs/communication/network_sockets/). |