Most Popular

1500 questions
5
votes
4 answers

Where in datasheet is the warning about unreliability of reading PINxn?

I use atmega32u4 (but believe it applies to all models). Here is the datasheet. Consider the following C program (I use AVR-GCC 5.4.0): #include int main(void) { PORTB |= 1 << PB5; /* pullup */ DDRB |= 1 << PB0; /* LED */ if (!(PINB…
5
votes
1 answer

Why are Arduino timer registers not 0?

I'm trying to use the timer registers to do some timing on my Arduino Mega 2560. The output of the following code confuses me: void setup () { // Set up serial connection Serial.begin(9600); while (!Serial) {} // Print control…
Paul
  • 165
  • 4
5
votes
3 answers

Convert long to char array and back

I'm trying to store a state in my data logger. I can read/write fine to SD, but I can't wrap my head around reading/writing a long value correctly - I've build it down to converting it to char array and back. My best try so far has been long temp =…
Blitz
  • 155
  • 1
  • 1
  • 5
5
votes
1 answer

How to work with non-traditional UART baud rates

I am trying, unsuccessfully to communicate, using my Arduino Nano, with a custom device at a baud rate of 800 kbit/s. The Arduino code look like this: void setup() { // Put your setup code here, to run once: Serial.begin(800000); } void loop()…
user28282
  • 55
  • 1
  • 5
5
votes
1 answer

How to debug an Arduino sketch on a Mac?

I have 2 Lowpowerlab WaterMote's talking to each other using the 'out of the box' pre-installed sketch that just confirm they're talking to each other. I verified this by opening a COM connection and saw traffic of 'receiving packets...' That was…
Jose Leon
  • 735
  • 1
  • 6
  • 11
5
votes
2 answers

How does an LED in an LED-strip like WS2811 know when it should be on or off

I was experimenting with an Arduino board and an LEDstrip WS2811 it works all perfect, but I do not understand how a particular led knows when it is called or adressed. Does every led have a unique address?
Anne Mabellon
  • 83
  • 1
  • 7
5
votes
3 answers

How to improve response time of this sound operated LED?

I have written the following code for lighting an LED on a clap ( using sound sensor) that I have connected via a resistance of 330 OHM on pin number 4. However, when I clap once, close to the sound sensor, it does not lights the LED. But it…
Haider Ali
  • 51
  • 1
5
votes
1 answer

Which reflectance sensor array for a line following robot?

I'm working on a line-following robot with my son. We've found a sensor array on Robot Shop that will help us but .. there's two and I'm not sure which will be the best for us. The difference between them, as described in this PDF is "The QTR-8A…
RickMeasham
  • 345
  • 3
  • 13
5
votes
1 answer

Wire.endTransmission() Hangs

I have written a code that transmits data over the I2C channel, The device ID and every other stuff is working fine. The only issue being that my code gets stuck at Wire.endTrasnmission(). I found the issue using Serial debug messages. Strange…
ArunMKumar
  • 205
  • 1
  • 2
  • 8
5
votes
2 answers

Different Arduino packages on Raspbian

I'm working on using my Raspberry Pi (Raspbian) to upload sketches. However, I'm not sure which package is appropriate for command line usage (like described here on Github). It seems like sudo apt-get install arduino would install the whole IDE,…
Anonymous Penguin
  • 6,285
  • 10
  • 32
  • 62
5
votes
2 answers

What will happen if I set ARef to 3.3V and try to use adc connected to 5V

What will happen, if I try to measure voltage higher than ARef? For example, my ref is 3.3V, and I try to measure 4.5V. Will it damage adc?
Etwus
  • 153
  • 4
5
votes
3 answers

When to use PROGMEM?

I believe PROGMEM is used to store large data (e.g. strings) that don't change. So it frees up the SRAM. in the Ardunio Reference it is mentioned that. "Using PROGMEM is also a two-step procedure. After getting the data into Flash memory, it…
5
votes
2 answers

if/else statements without comparison operators and curly braces

I recently came across this code in a tutorial. The code works, but this form of syntax seems to differ quite a bit from https://www.arduino.cc/reference/en/language/structure/control-structure/if/, as it's lacking comparison operators and curly…
Erik
  • 261
  • 1
  • 12
5
votes
2 answers

How to deal with unusual neopixel grid

I have built a custom installation in my home with 896 WS2812 LED driven by an ArduinoMega 2560 and powered by several rails just fine. However, the installation is arranged in a checkerboard-like pattern. There are 14 panels with 8 strips of 8 LED…
GhostToast
  • 153
  • 4
5
votes
3 answers

How to use digital pin as ground?

I have recently brought an arduino nano. It has only two ground pins but I needed three for my project. Is there a way to use a digital or analog pin as ground pin? Please show me how to do it
rocky saikia
  • 51
  • 1
  • 2