Command line Arduino compiling and uploading?

后端 未结 11 835
长发绾君心
长发绾君心 2020-12-13 17:37

How do I compile and upload Arduino sketches from the command line on Mac and Linux? I\'ve installed the Arduino programming environment. Are there some sample makefiles an

11条回答
  •  旧巷少年郎
    2020-12-13 18:16

    You need to actually create a viable cpp file out of your arduino sketch. The arduino environment does that for you automatically. One trick to get to those files is to open your arduino preferences.txt (it's in ~/Library/Arduino on the mac, I think in your Documents and Settings or Application Data on windows, don't remember exactly), and set build.verbose=true and upload.verbose=true. Start arduino, and compile your sketch (don't upload it). The console at the bottom will show you which files were compiled. You can now go to that directory, which will contain the cpp file, and compiled object files for all the core arduino objects. You can copy those into your project and use the cpp file to do further hacking. Let me know if you need more information about the Makefile, I can provide you with those I have.

提交回复
热议问题