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?

dda
1,5951 gold badge12 silver badges17 bronze badges
asked Jan 30, 2017 at 14:48

2 Answers 2

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
answered Feb 2, 2017 at 3:11
0

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

answered Jan 30, 2017 at 16:47
1
  • 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. Commented Jan 31, 2017 at 16:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.