【问题标题】:Arduino Nano 33 BLE GPSArduino Nano 33 BLE GPS
【发布时间】:2020-07-17 22:58:44
【问题描述】:

我想用一个简单的例子来测试我的新 GPS 板 (NEO-M9N):

#include <SoftwareSerial.h>
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
void setup()
{
    Serial.begin(115200);
    ss.begin(GPSBaud);
}
void loop()
{
// Output raw GPS data to the serial monitor
    while (ss.available() > 0){
        Serial.write(ss.read());
    }
}

但是,当我尝试在我的 arduino nano 33 ble 上运行它时,我收到了这个错误:

SoftwareSerial.h: No such file or directory

我需要做什么才能使用 arduino nano 33 ble 运行此代码?

【问题讨论】:

  • 你在库管理器中安装了库吗?
  • SoftwareSerial.h 的完整路径是什么? (例如)如果是/foo/bar/baz/include/SoftwareSerial.h,您需要将-I/foo/bar/baz/include 添加到编译器命令行。但是,它可能没有被安装。通常,给定包的配置脚本可以告诉您.h.so 文件的安装位置(例如pkg-config)。顺便说一句,基于SoftwareSerial ss(RXPin, TXPin);ss.begin(GPSBaud),这是not 有效的c 代码。看起来有点像c++
  • 我用我的 Arduino Uno 尝试了这段代码,它成功了。只有我的 Arduino Nano 33 BLE Sense 有问题。

标签: c arduino gps


【解决方案1】:

this forum topic 看来,SoftwareSerial.h 似乎不存在用于 Arduino Nano 33 BLE Sense 板。但是可以创建以下this Github issue 串行通信:

UART mySerial(digitalPinToPinName(4), digitalPinToPinName(3), NC, NC);

也可以看看this Github issue

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-07-14
    • 1970-01-01
    • 2020-10-28
    • 2022-07-03
    • 1970-01-01
    • 1970-01-01
    • 2021-10-28
    • 1970-01-01
    相关资源
    最近更新 更多