All Questions

81
votes
3answers
72k 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?
87
votes
19answers
105k 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: ...
63
votes
4answers
43k 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 ...
1
vote
3answers
4k 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 ...
19
votes
3answers
5k 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 ...
194
votes
12answers
331k 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 ...
36
votes
1answer
142k 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: ...
40
votes
5answers
102k 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?
10
votes
1answer
2k 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" ...
11
votes
2answers
11k 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 ...
4
votes
2answers
5k 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
1answer
4k 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?
85
votes
19answers
14k 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++...
45
votes
10answers
247k 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 ...
50
votes
13answers
38k 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 ...
16
votes
3answers
6k 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 ...
8
votes
2answers
2k 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 ...
36
votes
4answers
52k 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 ...
37
votes
4answers
8k 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 ...
42
votes
10answers
169k 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); ...
44
votes
7answers
67k 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 ...
25
votes
7answers
24k 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 ...
8
votes
1answer
12k 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 ...
9
votes
2answers
18k 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 ...
16
votes
13answers
57k 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 ...
53
votes
7answers
112k 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 ...
20
votes
4answers
82k views

What is Serial.begin(9600)?

I know that this is to print something: Serial.begin(9600); But I want to know what it really means?
19
votes
5answers
6k 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 ...
33
votes
8answers
106k 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 ...
6
votes
4answers
5k 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 ...
1
vote
2answers
3k 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 ...
18
votes
1answer
48k 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 ...
17
votes
2answers
4k 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 ...
24
votes
2answers
21k 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?
7
votes
2answers
32k 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(...
5
votes
5answers
20k 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 ...
3
votes
1answer
7k views

How to set Alarms on the DS3231 easily so the Nano doesn't have to go to sleep with delay statements?

I want my solar array sun tracker to shut down at night then move full east in the morning to catch the first rays. I know the DS3231 can set alarms but it is not clear from its documentation how ...
2
votes
2answers
7k views

Reading from a KY-040 rotary encoder with Digispark

I have a rotary encoder KY-040 connected to a Digispark like this: CLK go to p0 and and DT go to p2, SW is disconnected for now (it's just a button). I did everything like the instructions here: ...
1
vote
1answer
563 views

Can external interrupts be OR'd together on the '328 (Uno)?

I'm thinking about how to handle a rotary encoder. I'm planning on using interrupts and would like to use both the 'A' and 'B' phase transitions to generate interrupts. I'm wondering if there is any ...
72
votes
9answers
157k 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 ...
26
votes
4answers
67k 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 ...
13
votes
1answer
6k views

How does serial communications work on the Arduino?

With reference to the Arduino Uno, Mega2560, Leonardo and similar boards: How does serial communications work? How fast is serial? How do I connect between a sender and receiver? Please note: This ...
44
votes
11answers
7k views

Is an Arduino capable of running 24/7?

I'm making a simple Arduino web server and I want to keep it turned on all the time. So it must endure to stay working continuously. I'm using an Arduino Uno with a Ethernet Shield. It's powered ...
23
votes
3answers
41k views

Is it better to use #define or const int for constants?

Arduino is an odd hybrid, where some C++ functionality is used in the embedded world—traditionally a C environment. Indeed, a lot of Arduino code is very C like though. C has traditionally used #...
11
votes
2answers
7k views

Put ATmega328 in very deep sleep and listen to serial?

I have investigated the sleeps options of the ATmega328, and read a few articles about it, and I would like to understand if there are more options. So I would like to get as low current as possible, ...
1
vote
2answers
625 views

Locking ATmega328 from reading back the hex file

I want to completely block the access to an ATmega328. How do I do this? I have Atmel ICE, AVR studio 7 and Arduino. Bootloader - optiboot_atmega328 Fuses(without lock) - 0x05, 0xDE, 0xFF Steps I ...
3
votes
2answers
31k views

“stray '/302' in program error” when compiling

For some weird reason, the following code doesn't compile. I get a "stray '\302' in program" error around volatile unsigned int encoderPos = 0;, and I have no idea what the issue is. I've been trying ...
2
votes
1answer
450 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 ...
1
vote
1answer
13k views

Use object of other class within class

I am writing a class for a project which will take care of handling any LCD updates for my project. The way I want to handle this is to initialize the LCD object in my main file, and then pass the LCD ...
8
votes
1answer
558 views

Overview of compiled code size

When I compile my code, the Arduino IDE returns the binary sketch size in byte. Is there a good way to find out (approximately) what function or what part of my code takes up how much memory in ...

15 30 50 per page