I am working on a very long code that requires multiple functions defined. I want to split the code into two files as main code ("Feeder_Control" in the screenshot) and functions ("connections" in the screenshot) How to import the second file into main code to use its functions?

PS: In C/C++ same thing is done with #include "connections.h". How is it done in Arduino IDE.

look here.

  • 3
    Though the accepted answer works, I feel while the Arduino "IDE" is great for beginners but it doesn't quite scale well beyond a couple of files. I'd highly recommend checking out platformio as it provides much better project management via integration with atom and vscode, enables you to work with different frameworks including Arduino for AVR, STM32, ESP8266, ESP32 etc and supports debugging if you have the required hardware. Jan 15, 2019 at 19:39
  • Don't cross post. You already asked this on SO.
    – gre_gor
    Jan 16, 2019 at 17:53

1 Answer 1


There is no need to use an #include directive for the additional .ino file.

Before compilation starts, the Arduino IDE concatenates all .ino files in your sketch into a single file, starting with the .ino file that matches the sketch folder name, followed by the rest of the .ino files in alphabetical order. So there is no difference between one massive .ino file and breaking the same code among multiple .ino files, other than the greater ease of navigating the code via tabs. After a bit more processing, this file is compiled as C++.

Reference: https://arduino.github.io/arduino-cli/latest/sketch-build-process/#pre-processing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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