Tests for the ESP8266Interface running Espressif Firmware

Dependencies:   ESP8266Interface NSAPITests NetworkSocketAPI mbed

Fork of ESP8266InterfaceTests by NetworkSocketAPI

Note

This example code assumes your ESP8266 is running the Espressif Firmware. For instructions on how to update your ESP8266 to use the correct firmware see the Firmware Update Wiki Page.

Committer:
bridadan
Date:
Thu Mar 03 21:10:26 2016 +0000
Revision:
0:99f47847188c
Child:
1:be56c18eabec
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bridadan 0:99f47847188c 1 /* NetworkSocketAPI Example Program
bridadan 0:99f47847188c 2 * Copyright (c) 2015 ARM Limited
bridadan 0:99f47847188c 3 *
bridadan 0:99f47847188c 4 * Licensed under the Apache License, Version 2.0 (the "License");
bridadan 0:99f47847188c 5 * you may not use this file except in compliance with the License.
bridadan 0:99f47847188c 6 * You may obtain a copy of the License at
bridadan 0:99f47847188c 7 *
bridadan 0:99f47847188c 8 * http://www.apache.org/licenses/LICENSE-2.0
bridadan 0:99f47847188c 9 *
bridadan 0:99f47847188c 10 * Unless required by applicable law or agreed to in writing, software
bridadan 0:99f47847188c 11 * distributed under the License is distributed on an "AS IS" BASIS,
bridadan 0:99f47847188c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bridadan 0:99f47847188c 13 * See the License for the specific language governing permissions and
bridadan 0:99f47847188c 14 * limitations under the License.
bridadan 0:99f47847188c 15 */
bridadan 0:99f47847188c 16
bridadan 0:99f47847188c 17 #include "mbed.h"
bridadan 0:99f47847188c 18 #include "ESP8266Interface.h"
bridadan 0:99f47847188c 19 #include "NSAPITests.h"
bridadan 0:99f47847188c 20
bridadan 0:99f47847188c 21 ESP8266Interface iface(D1, D0);
bridadan 0:99f47847188c 22
bridadan 0:99f47847188c 23 int main()
bridadan 0:99f47847188c 24 {
bridadan 0:99f47847188c 25 int32_t result = iface.connect("ssid", "password");
bridadan 0:99f47847188c 26
bridadan 0:99f47847188c 27 if (result) {
bridadan 0:99f47847188c 28 printf("Interface failed to connect with code %d\r\n", result);
bridadan 0:99f47847188c 29 } else {
bridadan 0:99f47847188c 30 nsapi_tests("ESP8266Interface Tests", &iface, "0.0.0.0", 4000);
bridadan 0:99f47847188c 31 iface.disconnect();
bridadan 0:99f47847188c 32 }
bridadan 0:99f47847188c 33 while(1) {
bridadan 0:99f47847188c 34 }
bridadan 0:99f47847188c 35 }