Writing code isn’t always as easy as you want it to be. During the time since my last update about the soldering pen FW I’ve been trying to figure out how to do it best. I really miss the debug feature with a ‘real’ MCU. using the Arduino IDE is easy and fast but it has some serious drawbacks – debugging in place being one of the really big ones! I know that the simplicity comes at a cost and I really miss working on a full-fledged IDE that uses a big-ass programmer with hardware breakpoints and all the bells and whistles.
So what Have I done so far?
I’ve started splitting the project into seperate files. LED functions in LED.c (and LED.h) and so on. Luckily the IDe allows for multiple files. I stille remember the days when it didn’t. Code was even more cluttered back then and that was also one of my big issues with the Arduino environment as a whole.
Anyway I’ve been working on getting the code split-up so I can rework the whole logic. the functions are all there but they can be better in terms of readability. I haven’t had that much time to sit down and focus on that coding so bear with me. Suffice it to say that I hope to make the code more stable, more logicliy placed and thus simpler to read.
The important thing when splitting into multiple files is that the usual C header file basics still apply. Include the .h files that you need in order to scope functions and variables accordingly.
What really surprised me was that you don’t automatically get the Arduino built-in functions with you. You need to specifically include “Arduino.h”. At least I would have thought it to be an inline library which would be <Arduino.h> but that doesn’t seem to work properly. Besides that little curiosity I am good to go on the multiple-files project.
Stay tuned! we’re getting there (slowly)