1

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?

1

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
0

You can't. It's a feature of Processing, on which the Arduino IDE is based.

  • The tools ino and ano 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 Jan 31 '17 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.