IDE & Debugging

AWOL: For Arduino, if I can't fix it with a serial print, it's usually fixed with a scope or a couple of channels of cheap USB logic analyser, but both my scope and my analyser have unhealthy amounts of dust on them.

Was there a dust storm?

MattS-UK: LOL. I think, sometime between 1989 and 2015, someone must have re-invented the word, 'troll.' I always thought posing the question, "Maybe it's troll food?" Could be considered troll like behaviour, similar to Godwin's law. The uncomfortable topic of the question, discourages natural discussion, thus the 'troll' suppresses counter point and imposes their own view.

The debate is essentially, the convenience of a debugger Vs the time it takes, to learn the fundamentally good practices, which obviate the need for a debugger in the first place.

This is a matter of opinion, with no correct answer. Hence the debate can resurface quite naturally, with no ulterior motive, hidden agenda or malicious intention, being involved. The debate itself can be a learning experience. Causing participants to consider or re-consider, different points of view to their own.

I would add to the debate. The few times I have used the Visual Micro debugging features, I ended up spending more time fiddling with the debugger, than isolating faults.

This does sound familiar :grin: One of the reasons debuggers could be of more interest is a change view of "programming" in the past 40 years of my career. I come from a time where programming meant thinking and designing program structure. And as punched cards was outsourced it was expensive. In other words the pressure to do it correct the first time was mandatory. With the coming of cheap fast compiling the necessity dropped and we move from an age of "think first act later" to "let's try this". the first step in loss of expertise. Then we outsourced programming altogether.... Now with the coming of this new age of cheap accessible electronics and a boost in local programming we are facing the challenge again. But, as I notice in education, "programming" is not taught anymore. Now they teach (if they ar lucky) "coding" which is something different. The workings of CPU architectures/system software is taught to a lesser community compared to the "old days" making it difficult to understand what is really happening. The alternative debuggers. I see it as a kind of symptom solving. No offence btw to the passionates :grin:

adele: So basically, when I use the "external editor" I just open the files in Notepad++ or Visual Studio to edit the code. Then I have the Arduino editor opened as well, and when I want to compile or upload, I just use the Arduino editor. As long as I've saved the project in the external editor, the changes will compile.

I can use the serial monitor to do the debugging. So I need to delete all of those serial statements before I upload the final project to Arduino? Does it hurt the leave them in the code?

I am using the Mega and I have probably 2,000 lines of code and I'm barely using any of the available memory according to the editor. When I compile it says I've only used a few percent of what is available.

Nope, use preprocessor and enclose your debugging code "conditionally" and than remove / udefine the preprocessor directive / flag .

define DEBUG


ifdef DEBUG



use preprocessor and enclose your debugging code "conditionally" and than remove / udefine the preprocessor directive / flag .

Or you could do it more flexibly and reliably, with macros that either expand to executable code or null statements depending on a single flag, so that the body of your code isn't rendered illegible with

#ifdef DEBUG
  Serial.println (F(__function__));
  Serial.println (F(" start"));

See here for the basic principle.

And example code here.

I like to use AtmelStudio and the built-in simulator for most of my debugging needs. For more advanced work, ATMEL sells their ATMEL-ICE at a very reasonable price for debugWire, JTAG and SWD protocols using AtmelStudio. No need to incorporate Visual Micro, you can find numerous tutorials around the net on how to compile for arduino using AtmelStudio.

westfw: (For some reason, the whole "printf vs "real debugger"" debate has shown up recently on about half-a-dozen different forums that I read. Multiple times, on some of them. Maybe it's the latest in troll food.)

Thanks for sharing such constructive contribution to this discussion.

AWOL: See here for the basic principle.

Voted for the BEST ever post on this site!