Skip to main content
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 ...
chrisl's user avatar
  • 16.3k
27 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"
D_Graeme's user avatar
  • 271
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 ...
James Waldby - jwpat7's user avatar
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 ...
gnasher729's user avatar
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 │ │...
Edgar Bonet's user avatar
  • 43.1k
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 ...
James Waldby - jwpat7's user avatar
4 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 '...
Lionelb's user avatar
  • 41
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 ...
Majenko's user avatar
  • 105k
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. ...
Mikael Patel's user avatar
  • 7,969
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 ...
jantje's user avatar
  • 1,382
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 ...
jwh20's user avatar
  • 1,045
4 votes
Accepted

Large arrays crash the arduino

In the edited version of your question, you wrote: I am using memcpy_P() in order to copy the arrays from PROGMEM to RAM. The whole purpose of PROGMEM is to avoid having to store the data in RAM. If ...
Edgar Bonet's user avatar
  • 43.1k
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 ...
Majenko's user avatar
  • 105k
3 votes

why does function affect my ISR?

This isn't the sort of approach you should use in an ISR. You need to get into the ISR, and get out of it ASAP. Set a flag, and read the flag in your code to decide what needs to be done. There ...
Scott Seidman's user avatar
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.
Edgar Bonet's user avatar
  • 43.1k
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 == ...
John Burger's user avatar
  • 1,875
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 ...
Majenko's user avatar
  • 105k
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 ...
Edgar Bonet's user avatar
  • 43.1k
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 ...
Edgar Bonet's user avatar
  • 43.1k
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 ...
Edgar Bonet's user avatar
  • 43.1k
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 ...
Nick Gammon's user avatar
  • 38.2k
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/...
Ignacio Vazquez-Abrams's user avatar
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 ...
Dave Tweed's user avatar
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 ...
st2000's user avatar
  • 7,325
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.
Majenko's user avatar
  • 105k
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 ...
Majenko's user avatar
  • 105k
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 ...
JRobert's user avatar
  • 15.3k
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 ...
Eduardo Lozano's user avatar
2 votes

Proteus - How to Debug Invalid Opcode?

Guys if you are facing the error of invalid opcode 0xffff at pc = 0x3e402 in proteus using Arduino, the GO to Arduino IDE software, and from the top menu, click on 'tool' and change the board type, e....
Ansar Niazi's user avatar
2 votes
Accepted

Maximum Capacity Debugging

From the bottom to the top of the RAM, you have: the .data section (statically allocated initialized variables) the .bss section (statically allocated non initialized variables) the heap (dynamic ...
Edgar Bonet's user avatar
  • 43.1k

Only top scored, non community-wiki answers of a minimum length are eligible