40
votes
My code seems to be a train wreck
The error cascade is caused by the missing opening curly bracket { at the start of the thirtyBullets() function. This causes the function name to be not declared and also the following function calls ...
24
votes
How do I resolve "avrdude: stk500_recv(): programmer is not responding"?
After trying numerous suggestions, 2 different boards, 3 different cables on a WinXP and a Win7 machine, I finally got things working by going to "Tools -> Processors -> ATmega 328P Old Bootloader"
9
votes
Accepted
How to use breakpoints for debugging
As noted in Majenko's answer, the Arduino IDE doesn't provide a breakpoint mechanism but Atmel Studio does support breakpoints.[*]
However, if you have a switch and an LED, you can track the ...
8
votes
My code seems to be a train wreck
You've found the bug, but how could you have found it easier?
The most important step mentally is to accept that you did something wrong. We don't know yet what, but it is exceedingly unlikely that ...
6
votes
Accepted
Simple LCD countdown timer
instead of 9, it printed 90
No, it didn't: it printed “9”. However, it did not erase the previous
value before printing “9”. Before printing the 9, the LCD had:
┌────────────────┐
│time left │
│...
5
votes
Multiple MFRC522 RFID reader on Uno bugs
For convenience, here is a comment: You wrote, “I've tried the code above but it didn't work”. That is inadequate to convey what happened and what you wanted to happen. Please edit your question ...
4
votes
Accepted
`servo.attach()` paralyzing (one) motor on L298N
The Servo library uses Timer 1 to create the servo control signal. That means it can run the servo on any pin or combination of pins, and at the 50Hz speed that a servo likes best.
However, pins 9 ...
4
votes
How to use breakpoints for debugging
The Arduino-Debug library provides a simple on-target debugger for Arduino sketches. Debug command are added directly to the sketch. A debugger command shell is started on break-points and assertions. ...
4
votes
How to use breakpoints for debugging
Though Majenko his answer is correct there are some other options.
As to the real hardware debugging as stated by majenko I would say:
Install and use a real IDE, such as Atmel Studio or the arduino ...
4
votes
Accepted
Onboard led HIGH and LOW seems reversed
As this image from Okdo Page on LED Driving shows, there are two ways to drive an LED from a GPIO output pin:
In the Active HIGH case, a HIGH output on the GPIO will turn the LED on since that will ...
3
votes
How to use breakpoints for debugging
Not in the Arduino IDE.
You need to:
Install and use a real IDE, such as Atmel Studio, and
Use a full hardware debugger
There is no provision for debugging through the UART/USB interface using the ...
3
votes
How do I resolve "avrdude: stk500_recv(): programmer is not responding"?
I had this problem when working with Arduino IDE and XOD running on top of it.
What I found; looked like baud rates were being set differently at different stages in the setup. I compared Windows '...
3
votes
Accepted
Logging without IDE
On Ubuntu, I usually simply do
stty -F /dev/ttyACM0 raw 9600
cat /dev/ttyACM0 > the.log.file
Replace 9600 with your baud rate of choice.
3
votes
error: expected primary-expression before '(' token
You seem to have been programming in Java recently, because many of your errors have a Java ‘whiff’ to them. This, as you’ve tagged, is C++, not Java.
sendMouseState:
a. You wrote leftPressed == ...
3
votes
Using Serial Plotter with Visual Studio Code
Without very specialized software that can create two new devices with the correct "teeing" policy, it's not going to be possible. Only one program can open a serial port at a time (certainly and ...
3
votes
How compile an Arduino program for a desktop PC
If you want to run the Arduino sketch on your desktop, you just have to
implement the Arduino core library for your PC.
It may not be as bad as it sounds. If your program makes only minimal
use of ...
3
votes
'for loop' seems to change the execution of pow()
This seems like a case of a confused compiler. More specifically, a
confused optimizer.
On the first occurrence of pow(10, places), the compiler noticed that
places must be equal to 5, and so replaced ...
3
votes
Simulating a button press using the Serial Monitor to run a Servo
There may be a problem with your smoothing logic, which is quite
convoluted. However, if the first code works fine, you can keep it
almost as-is, and only replace digitalRead() with a version that
...
2
votes
Accepted
Diode lights generate false interruptions
Aaaaah, ok, now I see...
You put
+5V - Reed - LED - input pin - 1k resistor - ground
right?
If so the problem is that a red led has (usually) a voltage drop of about 1.5V, while the green one ...
2
votes
Accepted
'Non-Deterministic' memory usage on Arduino
You haven't posted any code, so any answer is guesswork. However ... if your code makes decisions based on external events (eg. readings from sensors) then it may allocate memory differently, and in a ...
2
votes
Debugging with ISP
There is provision in the USBasp specification for a UART connection, however, not all manufacturers copy the original schematic exactly, and no firmware actually contains the appropriate code for CDC/...
2
votes
Problems stopping an if loop, and starting it as well
There are two major flaws with your program - and both of them can be "fixed" by you understanding some concepts better.
Firstly, in your program, there is no concept of "When the button is pressed", ...
2
votes
Self-diagnose components in the circuit
You could get your program to output messages to the serial pin on your board, Tx. For example:
Serial.begin(9600) //baud rate of 9600
Serial.print("Debug Message");
You can use this to print out ...
2
votes
why does function affect my ISR?
I'm not very familiar with the details of the Arduino infrastructure either, but I think your fundamental problem is the fact that you are doing GPIO (i.e., digitalRead() and digitalWrite()) both in ...
2
votes
How to programmatically choose "board model" and "port number" in Arduino IDE?
You can't in the Arduino IDE, it's not designed that way (you can't even have different board/port settings in different windows - it's stored in the Java equivalent of a single global).
Instead you ...
2
votes
Accepted
Controllino Debugging
Connector X1 has the pins you want.
ICSP is shared with the SPI pins. Wire those to your ICE in the same way as you wire the SPI pins of the ICSP header on a normal Arduino to an ICE.
2
votes
Counting number of people inside a room
Considering abandoning the ultra sonic sensors. Instead use 2 light beams positioned so a moving person would block one beam then both as they passed. This problem has been commercially solved for ...
2
votes
For loop broken?
When I ran your code as you presented it in the chat, lp stayed at 128. When I commented-out the "light_L1()" call in "runfor()", lp decremented by 1/2 its value per step as you would expect. The ...
2
votes
Proteus - How to Debug Invalid Opcode?
First: Use the ino.hex file instead of the .ELF file
Second: this error is showing because you are compiling your code with a different board. Make sure you are using the correct board over at the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
debugging × 92arduino-uno × 20
serial × 16
arduino-ide × 9
debug × 8
arduino-mega × 5
programming × 5
c++ × 4
i2c × 4
memory-usage × 4
sensors × 3
arduino-nano × 3
power × 3
led × 3
esp32 × 3
servo × 3
library × 3
pins × 3
c × 3
uploading × 3
code-optimization × 3
loop × 3
platformio × 3
esp8266 × 2
interrupt × 2