Hi!
I'm trying to build a system that enables people to easily debug during the Arduino project,I hope you can give me some ideas about some common bugs that occurs during the Arduino project. ![]()
Here is a list that I put together some time ago
Feel free to use some/all of it if it helps
Code testing a condition has a semicolon at the end of the test
Code with an array in it strays outside of the array bounds
Code that does any comparisons uses x = y instead of x == y at some point
Code that uses a for loop tests the wrong final value of the loop variable
Code with a while loop in it never changes the condition so the loop never ends
Code with a while loop in it never executes because the loop condition is immediately true
Code using Serial does not have Serial.begin()
Code with Serial.begin() in it sets the wrong baud rate
Code using Serial.available() with the Line Ending not set to "No Line Ending"
Code using SoftSerial uses 2 or more instances
Code that reads digital input has the input pins floating
Code that uses serial input or output uses pins 0 and/or 1 for something else
Code that divides one number by another uses int for the result even if the result will be a float
Code that divides one number by another uses ints when a float result is expected
Code uses a variable type inappropriate for the data being held
Code that uses global variables has local variables with the same name
Code with missing or extra curly brackets
Do you mean just software bugs?
both hardware and software are OK.Your help is strongly anticipated!![]()
Thank you very very very much!You are such a helpful person ![]()
So if my code is using say pin 2 for a button input but I actually have the button connected to pin 3, how would your system detect the error?
My system uses AI agent to analyze all the possible errors that may occur in your circuit and code.And it can automatically ask you to provide some more details about your code and circuit.Also you can upload the picture of your real circuit connection to enable the system to deeply analyze because it can do image analysis.There is a well-organized database with huge information that can be retrieve by the AI agent.Based on all these design,it can help you detect the error step by step,
You will make this forum obsolete
Actually, eliminating 90% of the ādoh!ā errors we see may not be a bad thing⦠Iād much rather focus on the issues an AI is more likely to miss. Most of the items on @UKHeliBobās list make my eyes glaze over, to the point where I often donāt bother any more. Leave the low-hanging fruit for others to pick, Iām not clamoring for more āsolvedā tickies.
I hate when that happens.
a7
Nor am I, but it takes almost no time at all to spot most of the items on my list. In fact I like to play "guess the likely problem" based on a posters description if they give enough detail, but each to their own
You do know that when you rack up 1024 solved tickles you get a free Arduino UNO, right?
a7
Hi @sleepking666. Lists of the problems with Arduino projects that are checked for by the official Arduino Lint tool are available here:
https://arduino.github.io/arduino-lint/latest/rules/
Arduino Lint only looks at the structure and metadata of Arduino sketch and library projects, not at the code (and obviously not at the hardware), so I'm not sure whether the list will be relevant to your project, but I thought it was worth mentioning in case it will be useful to you.
Counters of type float because a float can hold larger numbers...
C-strings without \0.
- a "wrong" I2C address (0x3F vs 0x27 due to the two different versions of the PCF8574)
- wrong baud settings between sketch and Serial Monitor
- blocking the code with delay and then trying to read a button with an ISR
- do to much in an ISR, or even using a delay or Serial.print in an ISR
- use wrong variable sizes
- posting just snippets of code instead of a MRE
- using several nested if conditions instead of a FSM
- using makros which could be replaced with const/constexpr
promotion rules (especially "integer promotion" on AVRs when int is 16bits) leading to incorrect math:
unsigned long delayTime = 1000 * 60 * 10; // 10 minute delay
Misunderstanding pin numbers vs functions:
#define MYINPUT 3
:
pinMode(MYINPUT, INPUT_PULLUP);
while (MYINPUT != LOW) {
// wait for button push
}
LED_BUILTIN = HIGH; // (less common)
Arduino Pin number vs Chip Pin Number vs port Bit Number (especially on non-AVR and bare-chip builds.)
PROGMEM confusions.
Code using Serial that assumes Serial.available() means ALL of the expected data is available.
Code using the more advanced Serial functions (eg Serial.parseint()) that end up pausing for a long time becase there is no terminating character and the default time out (1s) happens.
-
User using goto resulting in difficulty in troubleshooting their spaghetti sketch.
-
Not using break; in switch/case.
Checking an unsigned int for a value smaller than zero (and assuming that it will happen).
for (uint8_t i=10; i<0;i--) {
- I've done that

