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 ...
31
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"
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 │
│...
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 '...
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 ...
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 ...
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
Can't Upload Sketches to Arduino Nano Every
Here is a trick I use on some boards but first be the baud rate is the same in the terminal as in the sketch (Serial.begin(115200). If so then remove everything then put a jumper between ground 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
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 == true....
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
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
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
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 ...
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....
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 ...
2
votes
"expected primary-expression before '.' token" in debug code
In short: you have your macro backwards.
Macros are not formed as "Take this set of commands and call it X" but "Make this macro X and have it equate to this set of commands".
Where you have:
#...
2
votes
Accepted
Help with debugging code
You have installed the Adafruit DHT library via the Arduino library manager
The source code does not work with that library. It is written to use the DHT library written by Rob Tillaart, named DHTLib. ...
2
votes
Help solving "collect2.exe: error: ld returned 1 exit status" error in code
I have figured it out.
The problem was I had not properly set up the project with the proper libraries. I thought I was doing it right manually but I was not. PlatformIO has a really convenient ...
2
votes
Accepted
Custom LED toggling function: one out of three LEDs misbehave
It seems to be a hardware fault, as others have suggested:
I connected the LED to another pin(8) and it works perfectly, everytime.
Looks like something got fried internally on that specific pin
1
vote
Accepted
For loop broken?
Don't ever use a global variable for for loop.
You use the same variable in functions for loops which count down to zero. If lp is zero for loop in loop() ends and new loop() starts.
1
vote
My code seems to be a train wreck
Just to add to the idea of using an array—since C does not care about whitespace you can quite easily format your data like this:
uint8_t led_pattern[10][7]= {
{0, // pattern for the digit 0
...
1
vote
"expected primary-expression before '.' token" in debug code
You defined the pre-processor macro the wrong way around.
Think it is like an assign statement. You come up with a name and assign something to it.
#define SHORT_NAME(ARG) ...
1
vote
ESP - Nodemcu amica - attachInterrupt crash program
thanks @Juraj.
Ok, so all you need is rewrite all your interrupt function.
For example:
void getStatusFromMaster()
to
void ICACHE_RAM_ATTR getStatusFromMaster()
1
vote
Accepted
Weird problem with arduino
If you want to get a value from PROGMEM you must read it with pgm_read functions. Read the PROGMEM reference.
for (int i = 0; i < 8; i++) {
Serial.print(pgm_read_byte_near(pat + i),HEX);
}
pat[0]...
1
vote
Debug-logging without using Serial.print and without WiFi
Yes, what version of Arduino are you using?
For Arduino Mega, you can use Serial.println for writing debug data and Serial1.println for communication with HC-05. (See Example: MultiSerial Example)
For ...
1
vote
From Exploring Arduino Text
If you used the 9 V battery as described in the diagram, but with a 3 V rated motor, then the motor starts smoking and you might damage it. Use e.g. 2 AA batteries with 1.5 V instead of the 9 V ...
1
vote
error: expected primary-expression before '(' token
The compiler is giving you a clue that the problem is around line 106. You have there:
LinkedList<ModeAction> *lActions = new LinkedList<ModeAction>();
LinkedList<ModeAction> *...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
debugging × 94arduino-uno × 21
serial × 16
arduino-ide × 10
debug × 8
arduino-mega × 5
programming × 5
c++ × 4
memory-usage × 4
arduino-nano × 3
sensors × 3
esp32 × 3
power × 3
led × 3
i2c × 3
servo × 3
library × 3
pins × 3
c × 3
uploading × 3
ide × 3
code-optimization × 3
loop × 3
platformio × 3
esp8266 × 2