Skip to content

Commit 8caedb7

Browse files
committed
Merge branch 'main' into content/micropython/micropython-revamp
2 parents a547cb7 + ab4ec7b commit 8caedb7

File tree

18 files changed

+111
-6
lines changed

18 files changed

+111
-6
lines changed
Loading
Loading
Loading
Loading
Loading
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: 'Debugging the Arduino UNO R4 WiFi'
3+
description: 'Learn how to debug the UNO R4 WiFi with the Arduino IDE.'
4+
tags:
5+
- Debugger
6+
- IDE
7+
author: 'Hannes Siebeneicher'
8+
---
9+
10+
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.
11+
12+
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:
13+
- Enable debugging mode in the Arduino IDE
14+
- Create breakpoints for where we want to inspect the code
15+
- Monitor the value of a variable at a specific point in the program
16+
17+
Note that you **do not** need an external debugger to follow this tutorial.
18+
19+
***To learn more about general debugging principles, you can read up on the topic [here](/learn/microcontrollers/debugging).***
20+
21+
## Goals
22+
23+
The goals of this tutorial are:
24+
25+
- learn about the basics of debugging.
26+
- learn how to set up the Arduino IDE to debug an Arduino sketch.
27+
28+
## Hardware & Software Needed
29+
30+
- [Arduino IDE](https://www.arduino.cc/en/main/software)
31+
- [Arduino UNO R4 WiFi](https://store.arduino.cc/uno-r4-wifi)
32+
- [UNO R4 Board Package](/tutorials/uno-r4-minima/minima-getting-started)
33+
34+
## Debugging
35+
36+
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.
37+
38+
## Connection
39+
40+
The only thing you need to do is to connect your UNO R4 WiFi to your computer using a USB-Cable.
41+
42+
## Software
43+
44+
### Setting up the Arduino IDE
45+
46+
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.
47+
48+
![Blink Example](./assets/blink_example.png)
49+
50+
## Set Correct Programmer
51+
52+
To access and debug the Arduino's MCU it's important that we set the correct programmer. Select **Tools** > **Programmer** > **ARM CMSIS-DAP compatible**.
53+
54+
![Set Programmer](./assets/set_programmer.png)
55+
56+
## Setting Breakpoints
57+
58+
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.
59+
60+
![Setting a breakpoint](./assets/set_breakpoints.png)
61+
62+
## Start Debugging
63+
64+
Now you are ready to start debugging. Press "**Start Debugging**" next to the "Upload button" or click the icon in the left sidebar.
65+
66+
![Start Debugging](./assets/start_debugger.png)
67+
68+
You will see how your code is executed and **stopped** at the line you set the breakpoint. You can set as many breakpoints as you want, depending on where you want to stop your code.
69+
70+
To resume the code press the "**Continue**" in the top left corner and you will see how the code runs until the it reaches the next breakpoint.
71+
72+
![Resume Code](./assets/resume_code.png)
Loading

content/hardware/02.hero/boards/uno-r4-wifi/tutorials/eeprom/eeprom.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The goals of this tutorials are:
2626

2727
## EEPROM
2828

29-
Electronically erasable programmable read-only memory (EEPROM) is a memory that can be used to store data that can be retrieved after power loss. This memory can be effective to use during run-time to log data can be used to re-initialize whenever a system comes back online.
29+
Electronically erasable programmable read-only memory (EEPROM) is a memory that can be used to store data that can be retrieved after power loss - it is non-volatile. EEPROM memory can be useful during run-time to log data, or can be used to re-initialize variables whenever a system comes back online.
3030

3131
When writing to the EEPROM memory, we specify two parameters: the **address** and **value**. Each byte can hold a value between 0-255.
3232

@@ -90,4 +90,4 @@ void loop() {
9090

9191
## Summary
9292

93-
In this tutorial, you've learned how to access the EEPROM on the UNO R4 WiFi board. To learn more about EEPROM, visit [A Guide to EEPROM](https://docs.arduino.cc/learn/programming/eeprom-guide).
93+
In this tutorial, you've learned how to access the EEPROM on the UNO R4 WiFi board. To learn more about EEPROM, visit [A Guide to EEPROM](https://docs.arduino.cc/learn/programming/eeprom-guide).

content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-usb/giga-usb.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ void setup() {
277277
278278
msd.connect();
279279
280-
while (!msd.connected()) {
280+
while (!msd.connect()) {
281281
//while (!port.connected()) {
282282
delay(1000);
283283
}
@@ -358,7 +358,7 @@ void setup() {
358358
359359
msd.connect();
360360
361-
while (!msd.connected()) {
361+
while (!msd.connect()) {
362362
Serial.print("MSD not found.");
363363
delay(1000);
364364
}

content/hardware/10.mega/shields/giga-display-shield/tutorials/02.gfx-guide/gfx-guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ To use the library, we simply need to create a display object, initialize the li
4343
GigaDisplay_GFX display; // create the object
4444
4545
void setup() {
46+
delay(3000);
4647
display.begin(); //init library
4748
4849
display.setCursor(10,10); //x,y
@@ -97,6 +98,7 @@ GigaDisplay_GFX display; // create the object
9798
#define BLACK 0x0000
9899
99100
void setup() {
101+
delay(3000);
100102
display.begin();
101103
display.fillScreen(BLACK);
102104
display.setCursor(10,10); //x,y
@@ -131,6 +133,7 @@ GigaDisplay_GFX display;
131133
#define BLACK 0x0000
132134
133135
void setup() {
136+
delay(3000);
134137
display.begin();
135138
display.fillScreen(WHITE);
136139
display.drawTriangle(100, 200, 300, 400, 300, 600, BLACK);
@@ -173,6 +176,7 @@ int counter;
173176
void setup() {
174177
// put your setup code here, to run once:
175178
Serial.begin(9600);
179+
delay(3000);
176180
display.begin();
177181
178182
if (touchDetector.begin()) {

0 commit comments

Comments
 (0)