Skip to main content
Share Your Experience: Take the 2024 Developer Survey
78 votes

Arduino Nano uploading gives error: avrdude: stk500_recv(): programmer is not responding

Know this is old but I ran onto it during my search for Nano(V3)'s not uploading so thought might help someone else. Problem is the bootloader - Arduino IDE BUT I Found an easy solution (right under ...
Goofy Brained's user avatar
8 votes

Loading local libraries

Okay, here is how it works, and I checked it to make sure. Sure you can use hard paths, but every programmer hates using hard paths. They are not portable at all, and they lock your program in place. ...
Sean Walton's user avatar
8 votes
Accepted

ino.hex vs ino.with_bootloader.hex

If flashing with AVR In System Programing (ISP) the bootloader is not needed. Only the flashing over Serial needs a bootloader. The ISP erases the flash including the bootloader. To be able to use ...
Juraj's user avatar
  • 18k
8 votes
Accepted

What exactly does the Arduino preprocessor do?

It does four things, basically: It adds #include <Arduino.h> to the top of your file, which gives you access to all the classes, functions and defined variables/macros of the API. It joins ...
Majenko's user avatar
  • 105k
7 votes
Accepted

"stray '/302' in program error" when compiling

0302 is 0xc2. Somewhere in your source you have one or more non-breaking spaces (0xa0) encoded in UTF-8 (0xc2 0xa0). Use od or a similar tool to find them, and then replace them with normal spaces. ...
Ignacio Vazquez-Abrams's user avatar
7 votes
Accepted

Using Arduino as a standalone compiler

First of all: The Arduino IDE brings its own GCC compiler. It is a version, that can compile for the AVR platform (don't know, if the standard version is capable of that). When you activate verbose ...
chrisl's user avatar
  • 16.3k
6 votes

How to generate true random numbers over Arduino Uno without any external hardware?

The standard (but not very good) solution is to seed the random number generator from an analogRead() on an unconnected pin. For better options, see this answer to a related question.
Edgar Bonet's user avatar
  • 43.3k
6 votes

What is wrong with my code? RGB potentiometer

Equality comparison in C and C++ is expressed by == operator. ==, not =. This if (wavecolor = 0) { actually assigns zero to your wavecolor variable, thus destroying the value you just read. The ...
AnT stands with Russia's user avatar
5 votes

What programming practices should be adopted while coding sketches for Arduino?

Paul covered the most important points. This answer is intended to be a complement to his. First, you should keep in mind the general rules, which are more important than the more specific ones. The ...
Edgar Bonet's user avatar
  • 43.3k
5 votes

What exactly does the Arduino preprocessor do?

See my answer: How the IDE organizes things I'm not sure if link-only answers which refer to a Stack Exchange link are OK. In case they are not, here is the first part of that answer: This is how ...
Nick Gammon's user avatar
  • 38.3k
4 votes

"stray '/302' in program error" when compiling

One cause of the /(302) error is copy and paste code from a word processor. You have ASCII codes copied that add spaces, etc to your code. Go through each identified line and remove any extra spaces ...
RogerR2's user avatar
  • 51
4 votes
Accepted

How to execute commands on Arduino (via PC) without touching the current sketch?

The simple thing would be for your sketch to read from the serial port continuously. If it finds something it stores it and when a newline arrives it sees if that happens to be a password known only ...
Nick Gammon's user avatar
  • 38.3k
4 votes
Accepted

Code is not working (Matrix keypad)

Cited comment: Check pin modes. Should be INPUT_PULLUP and OUTPUT. Also, consider debouncing. – Mikael Patel Please, try: const char keymap[4][4]={ {'1','2','3','A'}, {'4','5','6','B'}, {'...
AltAir's user avatar
  • 542
4 votes

The sketch burned two H Bridges, need help to find out how to modify

As you wrote in comment you use this H bridge: https://www.ebay.com/itm/60A-DC-Motor-Driver-Module-High-Power-motor-Speed-Control-Dual-Channel-H-bridge/122479397950 The description how to use it is ...
Filip Franik's user avatar
  • 1,292
4 votes

Branchless programing on arduino?

There is no cache, so you don't need to worry about that. All instructions are fetched direct from flash and executed straight away. There is, though, a 2-stage pipeline. That means that in one clock ...
Majenko's user avatar
  • 105k
4 votes

Can Arduino Sketch be used for production

There's a lot of controversy on this issue, but if it works for your needs, absolutely do it! Basically, there are 2 questions you have to answer: Should I use actual Arduino boards in production? ...
Gabriel Staples's user avatar
3 votes

Why does HC-SR04 return 0s in this sketch

pulseIn() may block up to 1 second (by default), which would happen everytime the HC-SR04 receives no echo, which might be the case if ultrasounds do not get properly reflected on a flat surface or if ...
jfpoilpret's user avatar
  • 9,132
3 votes
Accepted

HUGE deviation in Sharp IR sensor values if other pins are defined in void setup()

Not sure why commenting out those two lines makes a difference. I think we need to see a schematic to resolve this. However... You do not use "pinMode" to setup an analog input! Look at the ...
st2000's user avatar
  • 7,338
3 votes
Accepted

Include Git tag (or SVN revision) in Arduino sketch?

Inspired by Cellie's answer, I investigated further and found a similar method that can be implemented using the regular interface of the Arduino IDE. It appears that GitHub user Wackerbarth, while ...
Edgar Bonet's user avatar
  • 43.3k
3 votes

Include Git tag (or SVN revision) in Arduino sketch?

I struggled with Arduino (ESP32) versioning also. To make it somewhat more practical and less error prone I made some scripts to assist this process. Using these scripts is as easy as adding them to ...
Cellie's user avatar
  • 31
3 votes

Is there any way to download a sketch from an Arduino?

Download: avrdude \ -c <programmer type> \ -P <connection port> \ -b <override RS-232 baudrate> \ -p <partno, AVR device> \ -U <memtype>:r:file_name[:...
Doc's user avatar
  • 31
3 votes

DC motor makes noise but does not rotate

For the benefit of anyone reading Jeremy Blum's Exploring Arduino book who is having the same issue- he has labelled the transistor wrong in the book so the collector and emitter are back to front. ...
Anon's user avatar
  • 31
3 votes

How do I convert a program made on Notepad to my Arduino on Proteus

Besides displaying source code and letting you edit it, the IDE uses avr-gcc (and half a dozen other avr- utilities, like avr-objcopy, avr-ar, avr-nm) to compile and link the code and convert it to an ...
James Waldby - jwpat7's user avatar
3 votes

What programming practices should be adopted while coding sketches for Arduino?

Keep in mind that RAM is even less. 32KB is a fair lot of code, since C/C++ is highly efficient. "Don't save **** in RAM." If you need to load images into a display, save the images on an SD card. ...
aaa's user avatar
  • 2,695
3 votes
Accepted

Is there a way to "list" (in BASIC, or "cat" in LINUX) the current sketch loaded in my xxxDUINO?

No. the code burned in an Arduino is compiled not interpreted like Basic. Basically your C language sketch is compiled into AVR assembly language. The resulting hexadecimal is what is burned to the ...
Andre Courchesne's user avatar
3 votes
Accepted

Any good way to inverse a function?

No. A function does what it does and that is all. No other function can know what some other function does. You could write a function that does different things depending on what parameters you pass ...
Majenko's user avatar
  • 105k
3 votes
Accepted

How can I set a calculated value when my sketch is uploaded?

The C compilers provide two macros that resolve to string literals: __DATE__ gives the time the file was compiled, and __TIME__ gives the current time of day. They output e.g. "May 31 2017" and "21:...
Gerben's user avatar
  • 11.3k
3 votes
Accepted

A1 was not declared in the scope

RobotConfig.h needs to include Arduino.h in order to have those constants.
Delta_G's user avatar
  • 3,325
3 votes

ESP8266 Blink sketch - does not blink / or stays constant

You should connect Vcc to 3.3V, because that's how the ESP8266 is powered. RST is active-low reset and should be pulled to 3.3V
jose can u c's user avatar
  • 6,974

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