How does one organize code in the arduino environment? I am building the code for a new robot that I am building. I would like to organize the code where there would be a separate file for each function. Right now, I have a main part and would like to add a motors part. Additionally, I would like all this code to reside in the same directory. I cannot see how arduino would allow me to do this.
I have tried storing the motors code as an ino and a .h file. I have tried copying the .ino or .h file into the same directory but it seems as though I'm swimming upstream in the arduino river.
I've looked in the arduino software and learning web pages and don't see this information. I've already done the blink tutorial. If someone would be so kind as to also tell me where this information is located, it would be helpful.
If you are using the Arduino IDE the simplest thing is probably to create additional .ino files in your projects directory. The IDE will load them automatically in alphabetical order after the principal project .ino file. I think you can create another .ino file by opening a new tab in the Arduino IDE.
You should also be able to use .h files if you #include them
I don't use the iDE for my own editing. I use the Geany editor and I have written a short Python program that organizes the files and then calls the IDE to compile and upload the programs. That way I can use "grown-up" relative references for file locations.
I just put the extra code in .h files - probably heresy for "proper" C programmers.