All Questions
1,534
questions
169
votes
21
answers
474k
views
"avrdude: stk500_getsync(): not in sync: resp=0x00," aka Some Dude Named Avr Won't Let Me Upload My Program
I made an awesome program the other day, and I wanted to upload it to my Arduino. After clicking the upload button, some mean dude named avr came along and stopped me, saying:
avrdude: ...
103
votes
3
answers
107k
views
Have I bricked my Arduino Uno? Problems with uploading to board
I can't upload sketches to my Arduino Uno.
Have I "bricked" it?
What steps can I take to work out what is wrong?
What can I do to fix it?
128
votes
4
answers
96k
views
How can I handle the millis() rollover?
I need to read a sensor every five minutes, but since my sketch also has
other tasks to do, I cannot just delay() between the readings. There
is the Blink without
delay tutorial
suggesting I code ...
5
votes
1
answer
882
views
How do you combine 2 different sketches together
(Before you down-vote this, note that it is a "ringer" to answer a FAQ, with a self-answer.)
This question comes up all the time. How do you combine 2 different sketches together? Say I have a sample ...
21
votes
3
answers
8k
views
Classes and objects: how many and which file types do I actually need to use them?
I have no previous experience with C++ or C, but know how to program C# and am learning Arduino. I just want to organize my sketches and am quite comfortable with the Arduino language even with its ...
237
votes
13
answers
454k
views
Can I program for Arduino without having a real board?
I would like to start the development of some basic Arduino projects but I don't own an Arduino board yet. Is there a way I can write my code and emulate/test it using a desktop computer so after my ...
1
vote
3
answers
11k
views
My Arduino isn't showing up on my computer. What should I do?
You have your spangly new Arduino board, you've installed the software, and you plug it in. Nothing happens. Diagnosing problems may be a little tricky for the beginner, so what hoops should you go ...
60
votes
7
answers
204k
views
Is there any way to download a sketch from an Arduino?
I made a sketch, but then I lost it. However, I uploaded it to the Arduino before losing it. Is there any way I can get it back?
66
votes
1
answer
221k
views
How do you use SPI on an Arduino?
With reference to the Arduino Uno, Mega2560, Leonardo and similar boards:
How does SPI work?
How fast is SPI?
How do I connect between a master and a slave?
How do I make an SPI slave?
Please note: ...
14
votes
1
answer
5k
views
What happens when code is uploaded using the bootloader?
When I upload a new sketch to my Arduino Uno using the Optiboot bootloader, what really happens?
What is sent to the Arduino?
How does it respond?
What does "not in sync mean"?
What is "in sync" ...
93
votes
22
answers
18k
views
What are the other IDEs for Arduino?
The basic Arduino IDE lacks a lot of the sophistication present in other IDEs such as code completion, code collapsing, folder organisation, etc. Are there other IDEs that allow programming in C or C++...
9
votes
1
answer
7k
views
Adding a custom board to the Arduino IDE
I would like to know what is the procedure for adding a custom board to the Arduino IDE?
My custom board is similar to the Arduino Zero. Instead of using the ATSAMD21G18, my board is based around the ...
62
votes
13
answers
77k
views
Is there a way to have more than 14 Output pins on arduino?
Is it possible to have more than 14 output pins on the Arduino, I am working on a project in which I need to light up several LEDs individually. I only have an Arduino Uno, and I don't want to get a ...
61
votes
7
answers
103k
views
Is using malloc() and free() a really bad idea on Arduino?
The use of malloc() and free() seems pretty rare in the Arduino world. It is used in pure AVR C much more often, but still with caution.
Is it a really bad idea to use malloc() and free() with ...
13
votes
1
answer
26k
views
What's the difference between all the Software Serial Libraries? Which one is Arduino Nano compatible?
There are so many Software Serial Libraries, what are the differences between them? And which one I can use with my Arduino Nano? For my Arduino Nano I need one Hardware Serial Port and one Software ...
67
votes
12
answers
427k
views
How do I split an incoming string?
I am sending a list of servo positions via the serial connection to the arduino in the following format
1:90&2:80&3:180
Which would be parsed as:
servoId : Position & servoId : Position ...
37
votes
12
answers
135k
views
Arduino Nano uploading gives error: avrdude: stk500_recv(): programmer is not responding
I have a Arduino Nano (Sainsmart) that I'm trying to upload a sketch to. Under the Arduino IDE, the device selected was Arduino Nano w/ ATmega328.
However uploading the sketch gives me the error
...
16
votes
1
answer
25k
views
How do interrupts work on the Arduino Uno and similar boards?
Please explain how interrupts work on the Arduino Uno and related boards using the ATmega328P processor. Boards such as the:
Uno
Mini
Nano
Pro Mini
Lilypad
In particular please discuss:
What to use ...
5
votes
2
answers
7k
views
Read RC receiver channels using Interrupt instead of PulseIn
I am designing my own quadcopter control algorithm, whereby I currently read 4 RC receiver channels using PulseIn on each loop in the following manner:
ch1_raw = pulseIn(rcPin1, HIGH, 25000);
In ...
2
votes
1
answer
10k
views
Which pins of an Arduino UNO can be used as Tx and Rx pins for connecting to GSM GPRS SIM 900A
I am using Arduino UNO and SIM 900A. Pins 0 and 1 are used as TX and RX. Is it possible to use any other pins?
2
votes
1
answer
351
views
Wanted to control 2 servos with serial read [closed]
I want to use 2nd servo only when 1st is in up state by asking user whether he wants to fire or not.(code in bold is not working )
#include <Servo.h>
Servo myservo;
Servo trigervo;
...
56
votes
4
answers
93k
views
How high of a baud rate can I go (without errors)?
The standard is 9600 baud. That's just the standard. Using a Arduino Uno SMD R2, what is the highest practical baud rate I can achieve?
Bonus points for the audacious: How would you go about creating ...
19
votes
4
answers
8k
views
How can higher current devices (motors, solenoids, lights, etc.) be controlled by an Arduino?
I'm looking for a broadly applicable solution, one that can be adapted to a variety of projects.
I'm currently working on several projects that each require controlling devices ranging from 800mA to ...
9
votes
2
answers
3k
views
Can the 2nd MCU on the UNO R3 be used for keyboard emulation?
Following on from What's the 2nd ICSP header for in Arduino Uno R3? I was wondering how this could be hacked to our advantage.
For example, could that firmware be rewritten to have the UNO ...
43
votes
4
answers
10k
views
What are (or how do I use) the power saving options of the Arduino to extend battery life?
For solar & battery powered projects, decreasing power consumption is a necessity.
I know a little bit about using a timer and interrupt to put the microcontroller into sleep when it isn't doing ...
52
votes
12
answers
264k
views
How do I print multiple variables in a string?
Say I have some variables that I want to print out to the terminal, what's the easiest way to print them in a string?
Currently I do something like this:
Serial.print("Var 1:");Serial.println(var1);
...
28
votes
7
answers
36k
views
How can I get a unique ID for all my Arduino boards?
Once you have uploaded a sketch to one of your Arduino boards, it is hard to know exactly what source code led to that sketch.
Indeed, you may change the source code of your sketch on your PC without ...
22
votes
2
answers
72k
views
Reset an Arduino Uno in code
Is it possible to reset an Arduino (i.e., to reboot it) from code (i.e from the sketch itself)? I know that is possible with a special circuit but is there a chance to make it just with code?
Below ...
14
votes
2
answers
68k
views
Set PWM frequency to 25 kHz
I currently can set four PWM pins to around 31 kHz with the following code:
void setup()
{
TCCR1B = TCCR1B & B11111000 | B00000001; // Set PWM frequency for D9 & D10:
pinMode(...
8
votes
2
answers
25k
views
How to use a common anode 7-segment, 4-digit display?
Please take this question as an example to (my own) answer below.
I've got an 7 segment, 4 digit LED display, but I don't have any idea on how to wire it.
I don't understand the difference between ...
1
vote
2
answers
4k
views
How to change i2c address for mpu9250?
I'd like to connect 12 mpu9250 sensors to one arduino board.
I can't find documentation on how to change the addresses of mpu9250 boards. (i read through the reference ). Some tutorials talk about ...
0
votes
2
answers
615
views
How to rotate two or more steppers simultaneously by giving ARRAY of angles?
The following is the code that I am trying but the problem is steppers rotate one after each other. However, I want to rotate steppers simultaneously.
This code for two stepper motors.
int pulse=3;
...
101
votes
9
answers
252k
views
C++ vs. The Arduino Language?
What are the advantages of each language when using the Arduino?
I'm thinking this is a good general question, but I'll add a bit about why I'm asking if anyone wants to give me a tip.
I'm ...
77
votes
9
answers
165k
views
How can I create multiple running threads?
Is there a way I can have multiple parts of the program running together without doing multiple things in the same code block?
One thread waiting for an external device while also blinking a LED in ...
40
votes
10
answers
176k
views
Programming an Arduino using Python, rather than C/C++
I am not very skilled with the C Language and I was wondering if there is a way in which python could be used to program an Arduino. This would most likely require a different IDE in order to be able ...
28
votes
3
answers
126k
views
What is Serial.begin(9600)?
I know that this is to initialize something:
Serial.begin(9600);
But I want to know what it really means?
24
votes
3
answers
141k
views
NodeMCU - Vin pin as 5V output?
I know that Vin can be used to power the board but have also been reading that it can be used as a 5V output. Is it possible to assign Vin as an output as I would any other GPIO?
If I want to power ...
21
votes
2
answers
67k
views
How do I burn the bootloader?
I was instructed to "burn the bootloader" to my Arduino to fix an error I was getting. How can I do this? (And what exactly is the bootloader?)
19
votes
5
answers
9k
views
I'm using too much RAM. How can this be measured?
I would like to know how much RAM I am using in my project, as far as I can tell, there's no way to actually work that out (other than going through and calculating it myself). I have got to a stage ...
10
votes
4
answers
8k
views
How to interconnect multiple Arduinos with a Rpi to control home-lights/switches
While planning the lightning infrastructure (wall-switches and lights) of my new home (it's still under-construction) I choosed to go through the "automated route" way and due to my background (I'm an ...
5
votes
5
answers
43k
views
AT command is not responding on serial monitor
I am trying to send AT commands to ESP8266. I re-flashed ESP8266 http://imgur.com/a/J8Ueh I followed this tutorial http://remotexy.com/en/help/esp8266-firmware-update/ and I hope it re-flashed ...
2
votes
3
answers
9k
views
Playing Melody with Tone() without using delay()
Is there a method to play a Melody with Tone() without using the delay() function?
tone(8, melody[thisNote], noteDuration);
int pauseBetweenNotes = noteDuration;
**delay(pauseBetweenNotes);**
42
votes
4
answers
48k
views
Why does starting the serial monitor restart the sketch?
If I upload any sketch that sends serial data, I immediately see the TX/RX LEDs flash once the sketch is uploaded. If I then start the serial monitor, the sketch appears to restart.
A bare minimum ...
32
votes
2
answers
38k
views
How does the Arduino handle serial buffer overflow?
How does the Arduino handle serial buffer overflow? Does it throw away the newest incoming data or the oldest? How many bytes can the buffer hold?
30
votes
4
answers
80k
views
What can I do if I run out of Flash memory or SRAM?
According to the Arduino documentation, the ATmega328 has 32KB of Flash memory for the bootloader + uploaded sketch, and only 2KB SRAM for runtime data. The ATmega2560 has quite a bit more, totalling ...
30
votes
6
answers
53k
views
How to compile, upload and monitor via the Linux command line?
Interfacing an Arduino Uno (uploading etc.) with the Arduino IDE (using the Fedora package) works fine under Fedora 21.
But I rather want to use vim + make + vim-quickfix-mode etc.
How can I do that?...
18
votes
2
answers
6k
views
Should all unused analog input ports be tied to ground for accurate A2D measurements?
I am using the A0 port on my Arduino Uno to read the voltage output from an LM35 temperature sensor. I observed that the reading fluctuates a lot if I leave the remaining analog input ports A1 to A5 ...
13
votes
4
answers
6k
views
Getting a truly random number in Arduino
What is the best method to get a truly (as opposed to pseudo) random number in Arduino, or at least the best possible approximation? From my understanding, the function randomSeed(analogRead(x)) it's ...
13
votes
6
answers
17k
views
Sending Large Amounts of Serial Data
So in the fields of robotics sometimes you need multiple boards and or computers linked together to share information or save statistical data. Currently I need to send a few different variables over ...
4
votes
1
answer
5k
views
Problem sending string with Python to Arduino through serial port
I want to send string 50 to Arduino through serial port, the Arduino UNO seems it communicates with port COM25 but it doesnt receive the string properly:
import serial # if you have not already done ...