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
  • 15.6k
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"
D_Graeme's user avatar
  • 241
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
  • 41.4k
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
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,959
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,372
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,035
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

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
  • 31
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
  • 41.4k
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,855
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
  • 41.4k
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
  • 41.4k
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
  • 41.4k
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 ...
frarugi87's user avatar
  • 2,721
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
  • 37.6k
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

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", ...
Majenko's user avatar
  • 105k
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 ...
Alex Weir'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

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
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

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,130
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
  • 15k
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

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