XRobots / openDog

CAD and code for each episode of my open source dog series
GNU General Public License v3.0
825 stars 189 forks source link

Ardunio Sketches. #14

Closed IdrisTheDragon closed 5 years ago

IdrisTheDragon commented 5 years ago

Hey, I don't know if you already know this trick but you should consider using multiple files for one sketch instead of having everything in one bloated source file. The Arduino IDE makes this very easy:

  1. Click the new tab button and name it however you want. It will create a second .ino file next to your original in the sketch directory, and open a new tab in the IDE.

  2. Move your functions into the other files it creates, these functions are accessible in the main sketch file the same as if they where in the main file, no complex imports needed.

  3. Save hours of scrolling through the big file when you could just switch tabs to find the function/bit of code you want.

It's not very well documented online, but it is sooo useful for code organisation.

p.s. please start using git properly... you could add tags to mark the code commit for each episode. Then note this down in the README for non git users to understand, much nicer than partX folders...

IdrisTheDragon commented 5 years ago

Also https://create.arduino.cc/editor apparently this is a thing.

XRobots commented 5 years ago

Thanks for that. After Part 13 all the Arduinos are getting upgraded, so it'll be time for a code restructure.