Introduction: #11 Arduino and LED 7-segment Displays Using a MAX7219 - Part 3
In this final part about controlling 7-segment LED digits using a cheap but competent MAX7219 controller this video looks at the coding aspect.
Code is code, right? I mean, if it works (whether that is despite you or because of you) then all's fair in love and the compiler.
Well, no, not really.Unless you code for a living (as I do) then it's unlikely that many people will ever get to see your code. But you will, whether that is today, next month or even next year when you want to 'tweak' that design a tad. It's at that point you look at your previous efforts and think Just what was I thinking? as you try and decipher your oddly named variables such as "i", "j" and "k", as they nestle snugly up to a 6-level indented "if" statement. And not a comment in sight!
So this video tries to nudge all would-be Arduino developers in the right direction, coding-wise. It would take several week to teach the fundamentals of coding in C++ to a professional level but for hobbyists it's OK to tone it down a tad and perhaps use techniques (or, perhaps, not use industry-standard ones) that get your project working. Horses for courses, but not too many short-cuts that you will rue in the months and years to come.
Best of all, it doesn't need a degree in computer science just to put some structure in your code, to add a few comments and stop the spaghetti coding seen all too often in hobby projects. I was taught that if it looks structured, well laid out and, well, pretty, then you can be pretty sure the developer has a logical mind too!
So dive in and see if you can pick up some useful hints, tips and traps that will get your project working sooner, and better, than you perhaps thought possible.
Enjoy!