From be22fbe8311d9bb554ce141d9001cf5c24b19d09 Mon Sep 17 00:00:00 2001 From: Hannes Siebeneicher <60609597+Hannes7eicher@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:17:01 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Karl Söderby <35461661+karlsoderby@users.noreply.github.com> --- .../tutorials/debugger/debugger.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/content/hardware/02.hero/boards/uno-r4-wifi/tutorials/debugger/debugger.md b/content/hardware/02.hero/boards/uno-r4-wifi/tutorials/debugger/debugger.md index e569a92e4e..b08a1eed90 100644 --- a/content/hardware/02.hero/boards/uno-r4-wifi/tutorials/debugger/debugger.md +++ b/content/hardware/02.hero/boards/uno-r4-wifi/tutorials/debugger/debugger.md @@ -1,21 +1,22 @@ --- title: 'Debugging the Arduino UNO R4 WiFi' -description: 'Learn how to debug the UNO R4 WiFi.' +description: 'Learn how to debug the UNO R4 WiFi with the Arduino IDE.' tags: - Debugger - IDE author: 'Hannes Siebeneicher' --- -Debugging is the process of identifying and fixing errors in your code. It’s a vital skill for anyone writing code especially when dealing with microcontrollers like those on your Arduino. As with everything, debugging can be done at different levels, you can read up on the topic [here](/learn/microcontrollers/debugging). +Debugging is the process of identifying and fixing errors in your code. It’s a vital skill for anyone writing code especially when dealing with microcontrollers like those on your Arduino. -In this context, debugging is a term used to describe the process of inspecting the code at different points in time. +In this article, we will focus on using the Arduino IDE's built-in debugger, which can be used to debug the UNO R4 WiFi over USB. We will go through how to: +- Enable debugging mode in the Arduino IDE +- Create breakpoints for where we want to inspect the code +- Monitor the value of a variable at a specific point in the program -An analogy that is often used is to think of it as "stepping into" the code, grabbing full control of the clock and walking through it line by line, checking the value of variables as you go, and reading specific memory addresses to make sure information is being passed on as intended. +Note that you **do not** need an external debugger to follow this tutorial. -This is especially helpful when creating complex projects, but even as a beginner, it can be helpful to know the basics of debugging, consequently saving you time and energy when trying to find the little annoying error causing your program to break down. - -This article covers the basic steps for debugging the UNO R4 WiFi using the IDE, such as setting breakpoints. A breakpoint is an intentional stopping or pausing place at a specific point in the code, allowing you to read values at that exact point. In this case, we will be using the Arduino IDE which we can use to set breakpoints, read out memory addresses, and read the value of any variable at a specific point in time. +***To learn more about general debugging principles, you can read up on the topic [here](/learn/microcontrollers/debugging).*** ## Goals @@ -32,7 +33,7 @@ The goals of this tutorial are: ## Debugging -Debugging your Arduino project allows you to dive deep into your code and troubleshoot as well as analyze the code execution. Yu can gain full access to the microcontroller's internal registers, memory, and variables. This is especially helpful when working on more complex projects where understanding the code execution flow is crucial. With the Arduino IDE you can step through the code line by line, allowing you to analyze why your code might break at a specific point. +Debugging your Arduino project allows you to dive deep into your code and troubleshoot as well as analyze the code execution. You can gain full access to the microcontroller's internal registers, memory, and variables. This is especially helpful when working on more complex projects where understanding the code execution flow is crucial. With the Arduino IDE you can step through the code line by line, allowing you to analyze why your code might break at a specific point. ## Connection @@ -42,19 +43,19 @@ The only thing you need to do is to connect your UNO R4 WiFi to your computer us ### Setting up the Arduino IDE -First, if you haven't done it yet, install the [Arduino IDE](https://www.arduino.cc/en/software). It's a good ieda to verify that everything is working as it should by uploading the Blink example. +First, if you haven't done it yet, install the [Arduino IDE](https://www.arduino.cc/en/software). It's a good idea to verify that everything is working as it should by uploading the Blink example. ![Blink Example](./assets/blink_example.png) ## Set Correct Programmer -To access and debug the mcu it's important that we set the correct programmer. Select **Tools** > **Programmer** > **ARM CMSIS-DAP compatible**. +To access and debug the Arduino's MCU it's important that we set the correct programmer. Select **Tools** > **Programmer** > **ARM CMSIS-DAP compatible**. ![Set Programmer](./assets/set_programmer.png) ## Setting Breakpoints -As mentioned above a breakpoint is an intentional stopping or pausing place at a specific point in the code. You can add them by clicking the sidebar next to your sketch, and you should see a red dot appear. You have now set a breakpoint. +A breakpoint is an intentional stopping or pausing place at a specific point in the code. You can add them by clicking the sidebar next to your sketch, and you should see a red dot appear. You have now set a breakpoint. ![Setting a breakpoint](./assets/set_breakpoints.png)