Ted*_*son 5 arduino arduino-ide
我正在开发基于 Arduino 的系统,该系统将随着时间的推移而扩大。目前它只有湿度和温度读取功能。但很快就会添加门控、录音和 gsm 网络客户端支持。我希望所有这些都作为库包含并在主要部分中使用。我正在考虑一个包含所有其他模块并调用它们的函数的 ino 文件。我的问题是最好和最干净的方法是什么?
我建议坚持使用带有示例的库和库目录。每个要连接的组件的库。这将在很多方面有所帮助。比如调试和复用。
C:\Users\myself\Google Drive\Arduino\libraries\componentX\componentX.h
C:\Users\myself\Google Drive\Arduino\libraries\componentX\componentX.cpp
C:\Users\myself\Google Drive\Arduino\libraries\componentY\componentY.h
C:\Users\myself\Google Drive\Arduino\libraries\componentY\componentY.cpp
etc...
Run Code Online (Sandbox Code Playgroud)
这使其保持模块化和分区化。
请注意,我已将 Arduino 的 IDE 首选项更改为 Google Drive。(云备份和便携性)
然后而不是草图文件夹中的一个 BIG INO 文件
C:\Users\myself\Google Drive\Arduino\somethingBIG\somethingBIG.ino
实施 INO 文件
C:\Users\mflaga\Google Drive\Arduino\libraries\component\examples。
目录。这使得可以快速在 GITHUB 或 Google Drive 上发布组件以在系统之间共享。
然后,您可以拥有一个草图文件,将所有组件连接到您的主项目中。
C:\Users\myself\Google Drive\Arduino\somethingTOPlevel\somethingTOPlevel.ino