How do you specify a custom location for your sketch?
I want my code to be located in a src
folder, but when I try to compile my main.ino
, arduino
complains "The file main.ino needs to be inside a sketch folder named "main".
How do I disable this arbitrary restriction?
2 Answers 2
I found I could accomplish this using the arduino-builder tool. I created this simple bash script to do the compilation:
#!/bin/bash
CURRENT_DIR=`pwd`
mkdir -p $CURRENT_DIR/.build
arduino-builder -compile -hardware /usr/share/arduino/hardware -tools /usr/share/arduino/hardware/tools -tools /usr/share/arduino/tools-builder -libraries $CURRENT_DIR/lib -fqbn arduino:avr:uno -build-path $CURRENT_DIR/.build $CURRENT_DIR/src/main.ino
You can't. It's a feature of Processing, on which the Arduino IDE is based.
-
The tools
ino
andano
do this, still using the Arduino internals to do the compilation. I'd like to do this through the official command line interface, because those tools are no longer maintained.Cerin– Cerin2017年01月31日 16:05:41 +00:00Commented Jan 31, 2017 at 16:05