Using Visual Studio for my Arduino project I am struggling to know the states of various pins during operation.

I do use the Visual Micro debugger but I don't want to have to set a watch for every pin.

How can this be done easily?


Visual Micro provides this for you if you have the debug module enabled. It also optionally shows analog, memory and i2c. Read more about Arduino debug and the digital pin viewer

enter image description here


The Arduino Dashboard project sounds promising but quite likely it loops through the I/O pins periodically and uploads the results to your PC. I'm guessing you want live monitoring (as opposed to snapshots) while your own program (not the Dashboard sketch) is running. In that case, you'd need to isolate the relevant parts of the Dashboard sketch and integrate them with your code, and unless your are looking for fairly low frequency signal changes, have a timer interrupt function that runs the Dashboard frequently, which will have an impact on your own code. If the signals are fairly low frequency you might get away with putting a call to Dashboard in your loop() function instead of running it from a timer interrupt. If you're looking for program bugs that are changing your outputs, once per loop() may be fairly useless. A timer-interrupt would be necessary, and might have to analyze the stack and output the names or addresses of functions that had run recently. At that point you'd be on your way to implementing a debuggerand may want to consider an in-circuit emulator or a bus analyzer to capture the event. Or get smarter about isolating the code responsible for the event until you have a manageable, printf-debuggable code segment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.