You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Wemos D1无法运行代码求助:代码可上传但无输出无LED点亮

Troubleshooting Wemos D1: Garbled Serial Output & Unresponsive LED

Hey there, let's work through this Wemos D1 issue together—since you've confirmed drivers are installed, the board is recognized, and code uploads successfully, we can skip the basic connection checks. Here are the most likely fixes for your problem:

1. Match Serial Baud Rate

The Wemos D1 typically uses a default baud rate of 115200 for serial communication. Double-check two things:

  • Your code includes Serial.begin(115200); (or your custom specified rate) in the setup() function.
  • The serial monitor in your IDE is set to the exact same baud rate—mismatched rates will always cause garbled, unreadable output.

2. Correct Board-LED Pin Mapping

Unlike standard Arduino boards, the Wemos D1's onboard LED is connected to GPIO2 (labeled D4) and uses active-low logic (it turns on when the pin is set to LOW). If your Hello World code uses the standard Arduino LED pin (13), it won't work. Try this minimal test code:

void setup() {
  pinMode(D4, OUTPUT);
  Serial.begin(115200);
}

void loop() {
  digitalWrite(D4, LOW);  // Turns LED ON
  Serial.println("LED is ON");
  delay(1000);
  digitalWrite(D4, HIGH); // Turns LED OFF
  Serial.println("LED is OFF");
  delay(1000);
}

3. Fix Serial Monitor Line Ending Settings

Incorrect line-ending settings can make serial output appear broken or missing. Go to your serial monitor and set the line ending option to either:

  • Newline (\n)
  • Carriage Return + Newline (\r\n)

This matches the default behavior of Serial.println(), which adds both characters to each message.

4. Rule Out Power Supply Issues

Even if code uploads successfully, a weak USB power source can cause inconsistent behavior (like unresponsive LEDs or flaky serial). Try:

  • Plugging the board into a USB port on your computer's rear panel (these usually provide more stable power).
  • Using a powered USB hub instead of a direct laptop port.
  • Testing with an external 5V power supply connected to the Wemos D1's power pins.

5. Reset the Board After Upload

Sometimes the board doesn't automatically start running the new code after upload. Press the RESET button on the Wemos D1 right after uploading—this forces the board to reboot and execute your program from the start.

6. Verify Serial Initialization Timing

Make sure Serial.begin() is the first thing in your setup() function. If you try to print to serial before initializing the port, those messages will be lost, and subsequent output might be corrupted.


内容的提问来源于stack exchange,提问作者GB5

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:29:39