WeMos D1 上传代码后使用不了,串口监视器一直不停的滚动-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2349|回复: 4

WeMos D1 上传代码后使用不了,串口监视器一直不停的滚动

[复制链接]
发表于 2019-11-21 11:02 | 显示全部楼层 |阅读模式
WeMos D1 上传代码后使用不了,串口监视器一直不停的滚动
代码如下:
[mw_shl_code=arduino,true]/*
    This sketch demonstrates how to scan WiFi networks.
    The API is almost the same as with the WiFi Shield library,
    the most obvious difference being the different file you need to include:
*/
#include "ESP8266WiFi.h"

void setup() {
  Serial.begin(115200);

  // Set WiFi to station mode and disconnect from an AP if it was previously connected
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  Serial.println("Setup done");
}

void loop() {
  Serial.println("scan start");

  // WiFi.scanNetworks will return the number of networks found
  int n = WiFi.scanNetworks();
  Serial.println("scan done");
  if (n == 0) {
    Serial.println("no networks found");
  } else {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i) {
      // Print SSID and RSSI for each network found
      Serial.print(i + 1);
      Serial.print(": ");
      Serial.print(WiFi.SSID(i));
      Serial.print(" (");
      Serial.print(WiFi.RSSI(i));
      Serial.print(")");
      Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE) ? " " : "*");
      delay(10);
    }
  }
  Serial.println("");

  // Wait a bit before scanning again
  delay(5000);
}[/mw_shl_code]



串口监视器如下:

3ffffe60:  74656278 feef0061 feefeffe feefeffe  
3ffffe70:  feefeffe feefeffe feefeffe feefeffe  
3ffffe80:  7868636d 61746562 35313031 40204a00  
3ffffe90:  3ffe8765 00000000 61746562 40204ac1  
3ffffea0:  3ffe875c 005cc89a 00003c00 3ffee7d4  
3ffffeb0:  40203264 3ffee758 3ffe8763 40203270  
3ffffec0:  76b04000 00f8f4c2 0000001e ffffffff  
3ffffed0:  5041474e 3fffef00 40203d60 00000000  
3ffffee0:  00000000 00000000 00000000 fffffffe  
3ffffef0:  6968636d 7978686c 616e0000 40204ac1  
3fffff00:  3ffe875d 00000000 5041474e 40204ac1  
3fffff10:  3ffe8754 0ce3b0c2 00003900 3ffee7d4  
3fffff20:  40203264 3ffee758 3ffe875b 40203270  
3fffff30:  40203200 3ffee758 3ffe8781 00000002  
3fffff40:  00000004 00000000 3ffee720 00000001  
3fffff50:  3ffe84c8 00000000 3ffee758 3ffee7d4  
3fffff60:  3ffe84c8 3ffee720 3ffee758 40201101  
3fffff70:  0001c200 0000001c 00000000 feefeffe  
3fffff80:  3fffdad0 00000000 3ffee794 4020124f  
3fffff90:  feefeffe feefeffe feefeffe feefeffe  
3fffffa0:  feefeffe feefeffe 3ffee794 40203d78  
3fffffb0:  feefeffe feefeffe 3ffe84e8 40100bf5  
<<<stack<<<

ets Jan  8 2013,rst cause:2, boot mode3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d


发表于 2019-11-25 11:48 | 显示全部楼层
请确认下串口监视器是否是115200,与程序一致
 楼主| 发表于 2019-11-25 19:27 | 显示全部楼层
串口监视器j是115200,之前是正常的,就是几了几次后变成这样了!
发表于 2019-11-27 10:53 | 显示全部楼层
本帖最后由 kirbyklein 于 2019-11-27 10:55 编辑

我感觉是delay(5000)引起的,ESP8266用delay经常会报这些错误,你用millis()来计算时间试试,比如
unsigned long start;
if (millis() - start >= 5000){  //你的代码
  start = millis();
}

发表于 2019-11-28 20:29 | 显示全部楼层
楼主有没有试一下,setup()和loop()里面的代码都注掉看看还会不会这样,再一点点排除看是调了哪个函数会这样。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 04:48 , Processed in 0.106865 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表