Looking for programming tips and tricks on making sketches smaller. What can I do?
Smaller in what sense? Less generated code? Fewer lines of source code?
An example sketch that we could suggest how to improve might get better responses.
The best way to make sketches smaller is to write thousands of them. You'll learn how to minimize everything. Typing, code invention, etc.
Libraries are a big help. Let someone else, someone who is an expert in a subject are, develop, debug, and test the code. Then, just use it.
You could always make the sketch shorter by leaving functionality out, but that probably would get you fired, if you were writing the code for a living, so, forget that idea. :)
Smaller generated code that will take up less room on the arduino. I don't have any code to post at the moment, just looking for general tricks, if there are any.
I have started to create Libs as soon I have a repeating code. Saves a lot of memory. Example: One function I choose to name BPL. First BPL used 4300 bytes, next 4300 bytes again. With the BPL in a Lib, first BPL uses 4300 bytes, next only 900 bytes.
I don’t have any code to post at the moment, just looking for general tricks, if there are any.
Not a joke!
The general rule is NOT to optimize code unless you know it is necessary. This rules was not invented by myself, you find it as one of the first sentences in every book about programming style chapter “Performance” .
But google for “atmega c-code optimize” and one of the first link is this