【问题标题】:Can't see Serial.print() outputs in Visual Studio Code from Arduino device (ESP8266)在 Arduino 设备 (ESP8266) 的 Visual Studio Code 中看不到 Serial.print() 输出
【发布时间】:2021-01-15 15:47:44
【问题描述】:

我在我的 Arduino 设备(本例中为 ESP8266)的 Visual Studio Code 中看不到任何 Serial.print() 输出。我期待在调试控制台上看到它。是不是我的配置有误?

我知道我的代码正在工作,因为 LED 正在闪烁,但我在任何地方都没有看到任何输出。

这是我的代码:

#include <Arduino.h>

void setup()
{
    Serial.begin(9600); // EDIT: added this line
    Serial.println("Setup...");
    pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  Serial.print("On!");
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  
  Serial.print("Off!");
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW  
  delay(1000);                       // wait for a second
}

我正在使用这个板: https://www.waveshare.com/wiki/e-Paper_ESP8266_Driver_Board

这是我的 platformio.ini 文件:

[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino

; Custom Serial Monitor port
monitor_port = COM4

; Custom Serial Monitor speed (baud rate)
monitor_speed = 9600

【问题讨论】:

标签: arduino esp8266 arduino-esp8266


【解决方案1】:

通过添加以下代码在 setup() 中设置串口波特率:

Serial.begin(SERIAL_BAUD_RATE);

例如:

Serial.begin(9600);

最后在串口监视器中设置波特率

【讨论】:

  • 刚试过,但没有帮助:(谢谢。
  • 你在工具里设置你的端口吗-> 端口
  • 我没有使用 Ardunino IDE - 我使用的是 Visual Studio Code(根据我的问题)
【解决方案2】:

在 VS Code 屏幕的右下角附近有一个小插头图标。点击打开串口监视器。

【讨论】:

    猜你喜欢
    • 2021-11-11
    • 1970-01-01
    • 1970-01-01
    • 2023-02-08
    • 2018-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多