Most Popular

1500 questions
26
votes
3 answers

What happens to the Arduino if you don't use a resistor with an LED?

Making a blinking light seems to be one of the most common beginner projects with Arduino. A typical approach is to connect an LED + resistor (in series) to an IO pin, and connect the other end to ground. In code, you make the pin an output, and…
Peter Bloomfield
  • 10,842
  • 9
  • 46
  • 87
25
votes
14 answers

Project Showcase '14

The logo is a derivative of the Arduino Community Logo licensed under Creative Commons license CC-SA-BY-NC 3.0 Update: Winners Announced The winners of the contest have been announced. Please see the Meta post for details. To celebrate 10 years…
sachleen
  • 7,365
  • 4
  • 37
  • 55
25
votes
1 answer

What is the frequency of PWM output on Arduino

What frequency do Arduinos use for normal PWM when you use analogWrite()? And is it different for different Arduino model? I'm interested specifically in the Mega 2560, but also want to know if it's consistent between models. I've seen a passing…
Duncan C
  • 5,562
  • 3
  • 16
  • 28
25
votes
1 answer

ATtiny85: Power consumption vs clock speed

Short and simple: What is the power consumption for an ATtiny85 running at 1 MHz and 8 MHz using the internal clock? Not using any sleep modes. I have googled a lot and can't find any info on this. I ask because I want to know if it is worth using 1…
marlar
  • 467
  • 1
  • 6
  • 10
24
votes
3 answers

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 an LED from GPIO 12, I would assign GPIO: const int…
acpilot
  • 643
  • 2
  • 11
  • 25
24
votes
5 answers

What is the real lifetime of EEPROM?

ATMEL says the cell lifetime of an EEPROM cell is about 100,000 write cycle/ cell. Is this actually how the EEPROM performs in the wild? If I do not change the value of a cell, does this stress the lifetime? For example, if I write the value 0xFF to…
Marlon Abeykoon
  • 343
  • 1
  • 6
  • 12
23
votes
4 answers

Why use an int variable for a pin when const int, enum or #define makes much more sense

Why do people use a variable to specify a pin number when the pin is unlikely to change throughout the execution of the code? Many times I see an int being used for a pin definition, int led = 13; when the use of a const int const int led = 13; or…
Greenonline
  • 2,844
  • 7
  • 31
  • 46
22
votes
10 answers

How to identify Arduino Mini Pro 5v vs 3.3v

I have many Arduino Mini Pro, every from different seller. Few are 3.3v and most 5v. I had to clean table for Xmas and now I do not have any idea how to identify 3.3v Arduinos. They do not have any marks. I bought them on ebay. I know 3.3v has 8mhz…
Max
  • 323
  • 1
  • 2
  • 5
22
votes
4 answers

Communication Protocol Best Practices and Patterns

Every time I design a serial protocol to be used between two arduinos, I feel a bit like I'm reinventing a wheel. I wonder if there are any best practices or patterns people follow. This question is less about the actual code, but more about the…
Jeremy Gillick
  • 471
  • 1
  • 3
  • 8
22
votes
3 answers

Can a function be called automatically when an input changes?

Currently, my sketch is checking an input pin every time round the main loop. If it detects a change, it calls a custom function to respond to it. Here's the code (trimmed down to the essentials): int pinValue = LOW; void pinChanged() { …
Peter Bloomfield
  • 10,842
  • 9
  • 46
  • 87
22
votes
2 answers

Why do some pins have a different PWM frequency?

According to the Arduino reference for analogWrite(), the PWM frequency on most pins is ~490 Hz. However, it's ~980 Hz for pins 5 and 6 on the Uno, and for pins 3 and 11 on the Leonardo. Why are these different? Is it a deliberate design feature, or…
Peter Bloomfield
  • 10,842
  • 9
  • 46
  • 87
22
votes
2 answers

Why can't I declare a class in another tab in Arduino IDE?

I wanted to move some of my code out into a second tab in the Arduino IDE, to keep things better organised. At first, I only tried moving a function, and it seemed to work fine. I could call the function from the setup() function in my main tab, and…
Peter Bloomfield
  • 10,842
  • 9
  • 46
  • 87
22
votes
2 answers

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 is my code and the comment //reset is where I want…
kimliv
  • 541
  • 1
  • 4
  • 15
21
votes
12 answers

What type of connector does the GROVE system use?

What type of connector does GROVE use? I'm interested in wiring some old sensors so they're compatible with GROVE, so I first need to identify the connector so I can buy the housing and pins to crimp. It looks to be some type of JST connector, but…
Cerin
  • 1,578
  • 2
  • 21
  • 41
21
votes
1 answer

How to access multiple SPI interfaces on Arduino

I have worked on SPI devices connected with an Arduino one at a time. How do I work with two different SPI devices at the same time?