Skip to main content
9 votes
Accepted

"Best" architecture for handle events

Coming from the Web world, you are most likely used to work in a single-threaded environment (save for Web workers). You have been trained to program in a non-blocking fashion, as blocking the browser'...
Edgar Bonet's user avatar
  • 43.3k
5 votes
Accepted

Problem when coding 4x4 keypad's key detection (without library)

In case 2: digitalWrite(columnsPins[c], LOW); for(byte r = 0; r < DIMENSIONS; r++){ if(digitalRead(columnsPins[r]) == LOW){ Serial.println(keys[r][c]); } } Since you just wrote one of the ...
Delta_G's user avatar
  • 3,366
4 votes
Accepted

LCD I2C connection problems

Some common problems with LCD displays which incorporate an I2C backpack include: Not using the correct I2C address for the I2C backpack. Use an I2C scanner to discover the correct address. Mixing ...
6v6gt's user avatar
  • 1,053
4 votes
Accepted

How to ignore garbage values in serial communication between arduino and python

The effect that you see is type promotion, in the C++ standard called "integral promotion", which happens implicitly. Values of type char are cast to int. Commonly, and in your case too, the ...
the busybee's user avatar
  • 2,088
4 votes
Accepted

Why this simple serial monitor code not working?

You seem to have the assumption, that the string "QUICK" is send as one package of characters, because you send it with one keypress from the Serial Monitor. But Serial (UART) is a "...
chrisl's user avatar
  • 16.3k
4 votes

Arduino UNO Power interruption

Do you have to upload the UNO after the applied power is disconnected? No. Does the UNO retain the code without any power? Yes. And when the power is disconnected, if the code is retained, will ...
VE7JRO's user avatar
  • 2,558
4 votes
Accepted

ERROR: return reinterpret_cast<T>(pgm_read_ptr(p));

With the info from the link Fahad provided in the comments, I can only offer a guess: Your ESP8266 board definitions are outdated and the old version of the ESP8266 board definitions contains a bug. ...
orithena's user avatar
  • 499
4 votes

Is there a way to increase the number of output pins in Arduino Uno?

As an extension to Dario.Casciato’s response, there are not only I²C I/O expanders, but also the simple 74HC595 IC, which can be cascaded and used via Arduino's shiftOut function. It needs three ...
DataFiddler's user avatar
  • 1,045
4 votes

How to compile without adding the bootloader?

Seeing .bootloader section in size output doesn't mean it's really present. It just means the sum of all three is 4152 bytes. You can check the hex file if it contains large block of data at the ...
KIIV's user avatar
  • 4,752
4 votes

Why does an ESP01 WiFi module reset when it's connected to a DC motor/water pump?

The abs. max. supply voltage for the ESP-01s is 3.6 V; leaving out the voltage regulator and using 5 V for its power supply will likely have killed or at least damaged it. Also, the water pump needs a ...
ocrdu's user avatar
  • 1,795
4 votes

Translating analogWrite() into PWM duty cycle formula

On pins 5 and 6 (those controlled by Timer 0): duty cycle = (x+1)/256, except for x = 0, which gives a duty cycle of 0. On the other PWM pins: duty cycle = x/255 The difference comes from the fact ...
Edgar Bonet's user avatar
  • 43.3k
4 votes

AREF pin on Arduino Uno R3

On the ATmega328P (the microcontroller of the Arduino Uno), the AREF pin is initially floating. If you try to read its voltage, you can get basically anything. As soon as you select an analog ...
Edgar Bonet's user avatar
  • 43.3k
3 votes

What type of pin header is this?

These are corrupted female headers so remove them and solder new ones.
szachy-a's user avatar
3 votes

Nema 17 stepper motor speed problem

Stepper motors need to be gradually brought up to speed. If you try to go from zero rpm to anything over a few hundred rpm they will often just sit there and hum. Try AccelStepper (https://www.arduino....
Brian Robertson's user avatar
3 votes

DS3231 not keeping time when Arduino is turned off

rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); You have this line in setup that sets the date and time to the date and time that the code was compiled. That's fine to set it once, but that time ...
Delta_G's user avatar
  • 3,366
3 votes

"Best" architecture for handle events

The usual way to do things only once (at startup) is to put them in setup(). You put only statements in loop() that need endless repetitions. You can think of the underlying main function as: int main(...
the busybee's user avatar
  • 2,088
3 votes
Accepted

Timer interrupt setup for one second is too slow (~ 4 seconds)

There is a flag in TCCR1A/B called WGM12 which sets the wave generation mode (WGM) to Clear Timer on Compare Match (CTC). This causes the timer to count up to the value in OCR1A and then automatically ...
maddes8cht's user avatar
3 votes
Accepted

Why am I getting wrong compass heading using magnetometer readings?

Consider calibrating your magnetometer. Off the shelf, almost all magnetometers require calibration before making use of their data. The offset (commonly referred to as Hard Iron) and the magnitude (...
st2000's user avatar
  • 7,340
3 votes

Is there a way to increase the number of output pins in Arduino Uno?

It sounds like you are using some GPIOs ;) If you need more digital pins, you can use the analog pins as digital pins (if you didn't already). If you already occupied these pins, then I would think ...
Dario.Casciato's user avatar
3 votes

Is there a way to increase the number of output pins in Arduino Uno?

What you probably want is called an ‘I/O Expander’. They come in many different varieties based both on exact means you use to communicate with them, how many I/O pins they give you, and what you can ...
Austin Hemmelgarn's user avatar
3 votes

DHT20 and OLED display not working together

The basic problem I don't have this sensor kit. But am able to observe what you're describing with substitutes and stand-ins. There seem to be two things you can do. The basic problem is that the ...
timemage's user avatar
  • 5,299
3 votes
Accepted

Importing content of text file as string into Arduino code

For ESP32 (and ESP8266), you can partition part of the Flash memory to be used as the file system and creating a data/ folder in your project for storing files. Take a look at arduino-esp32littlefs-...
hcheung's user avatar
  • 1,406
3 votes
Accepted

LED control with a string variable

This question originated on electronics.stackexchange.com, copying my answer from there: There are three main areas where your system may be failing: the LEDs, the string input, and the logic ...
InBedded16's user avatar
3 votes

Why does the ADC report 0 in this sketch?

You have two different variables named ADC_output: one which is local to capture_FID(), and is always zero (it is never assigned another value) one local to ISR(ADC_vect), which is set but never used....
Edgar Bonet's user avatar
  • 43.3k
3 votes

Why does my Arduino show weird characters with my code?

It looks like you have the LCD connected to pins 0 and 1. Those are the Serial Rx and Tx pins. When you also use Serial in your sketch it creates a conflict. Move those two lines from the LCD to ...
Delta_G's user avatar
  • 3,366
3 votes

I need a 10KHZ PWM signal from pin 3 and 11 using timer 2

You can't do it with Timer 2 without external hardware. This code will generate a 10 kHz signal on pin 3, however it uses both of the timer's registers to do that: OCR2A is used to set the period (ie....
Nick Gammon's user avatar
  • 38.4k
2 votes

Arduino button voltage versus HIGH/LOW state

To answer the posted question literally: Yes, it is the correct way for your circuit, which has the button between the pin and GND, and the LED between VCC and the pin: simulate this circuit – ...
the busybee's user avatar
  • 2,088
2 votes

Rc switch library display received values only one times using serial monitor

Old post, I know but I have to add to it. The statement "transmitter.enableTransmit(10);" causes the RCSwitch library to send the message 10 times. You are receiving 4 messages; you ...
Larson's user avatar
  • 21
2 votes

Problem with reading data from ELM327

ELM has closed down, but as a curtesy have kept their documentation site available. Here's the link to the last version published, V2.3 in 2020 - https://www.elmelectronics.com/DSheets/ELM327DSL.pdf ...
Bruce Gennette's user avatar
2 votes

How do I use a transmitter and receiver to send string messages conditionally to a receiver?

I figured the issue out. code was a mess but after troubleshooting it for a while the if statements didn't make sense and had no good flow to them plus too complicated. I had copied and pasted some ...
Mario Ronci's user avatar

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