itead / ITEADLIB_Arduino_WeeESP8266

An easy-to-use Arduino ESP8266 library besed on AT firmware.
MIT License
526 stars 285 forks source link

Teensy 3.2 and ESP8266 #85

Open linuxsable opened 7 years ago

linuxsable commented 7 years ago

Hi. I'm trying to use your library with the Teensy 3.2 and the DIYmall ESP8266 ESP-01S.

I can get the ESP8266 connected up to the Teensy successfully via serial. What happens is the example program from your library compiles with no errors, but it's like it actually never successfully runs on the device.

Steps:

Expected: "setup begin" and other messages to show in the console. Also, the LED to blink, showing that the loop is actually running.

Actual: Nothing gets logged to the console, no LED blinks, showing that the loop() is never entered.

If I comment out the ESP8266 wifi(Serial1) line, the LED blinks and the loop() is entered. Otherwise it fails silently.

/**
 * @example ConnectWiFi.ino
 * @brief The ConnectWiFi demo of library WeeESP8266. 
 * @author Wu Pengfei<pengfei.wu@itead.cc> 
 * @date 2015.03
 * 
 * @par Copyright:
 * Copyright (c) 2015 ITEAD Intelligent Systems Co., Ltd. \n\n
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version. \n\n
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
#include "ESP8266.h"

#define SSID        "ThomYorke"
#define PASSWORD    ""

ESP8266 wifi(Serial1);

const int ledPin = 13;

void setup(void)
{
    pinMode(ledPin, OUTPUT);

    Serial.begin(9600);
    Serial.print("setup begin\r\n");

    Serial.print("FW Version: ");
    Serial.println(wifi.getVersion().c_str());

    if (wifi.setOprToStation()) {
        Serial.print("to station ok\r\n");
    } else {
        Serial.print("to station err\r\n");
    }

    if (wifi.joinAP(SSID, PASSWORD)) {
        Serial.print("Join AP success\r\n");
        Serial.print("IP: ");       
        Serial.println(wifi.getLocalIP().c_str());
    } else {
        Serial.print("Join AP failure\r\n");
    }

    Serial.print("setup end\r\n");
}

void loop(void)
{
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);   
}