filmov
tv
How to debug an Arduino program with the 'tracing' technique

Показать описание
Have you ever been faced with an Arduino board that crashes for no apparent reason?
Have you ever decode an ESP8266 (ESP32, etc.) exception stack trace and ended with more questions than answers?
If so, let me talk to you about a bulletproof technique: the good-old "tracing" technique.
In this video, I show you how you can debug virtually any Arduino program by using only the serial port. That's all! Tracing is just that, printing the current location so that you know where you are in the program. It acts as breadcrumbs that you can follow to see how you got there.
I show you how to create a handy macro that will help you add traces to your program. The macro prints the file name, the line number, the function name, as well as, the arguments and the template parameters. With a tool like that, you're getting a lot of information, which is essential to find a bug.
Then, I present you ArduinoTrace, the small library that I created just for that purpose. This library makes it very easy to add traces in a program. It requires absolutely zero initialization or other ceremonies. Include and enjoy!
To illustrate this technique, I show you how I fixed the latest bug in ArduinoJson. You'll see how tracing helps us get closer and closer to the bug until we can see the mistake right before our eyes.
Please check out ArduinoTrace at:
Don't forget to add a GitHub star; it greatly helps to promote the library.
Have you ever decode an ESP8266 (ESP32, etc.) exception stack trace and ended with more questions than answers?
If so, let me talk to you about a bulletproof technique: the good-old "tracing" technique.
In this video, I show you how you can debug virtually any Arduino program by using only the serial port. That's all! Tracing is just that, printing the current location so that you know where you are in the program. It acts as breadcrumbs that you can follow to see how you got there.
I show you how to create a handy macro that will help you add traces to your program. The macro prints the file name, the line number, the function name, as well as, the arguments and the template parameters. With a tool like that, you're getting a lot of information, which is essential to find a bug.
Then, I present you ArduinoTrace, the small library that I created just for that purpose. This library makes it very easy to add traces in a program. It requires absolutely zero initialization or other ceremonies. Include and enjoy!
To illustrate this technique, I show you how I fixed the latest bug in ArduinoJson. You'll see how tracing helps us get closer and closer to the bug until we can see the mistake right before our eyes.
Please check out ArduinoTrace at:
Don't forget to add a GitHub star; it greatly helps to promote the library.