Most Popular

1500 questions
10
votes
3 answers

arduino - millis()

Copied from the Arduino reference - millis() Tip: Note that the parameter for millis is an unsigned long, errors may be generated if a programmer tries to do math with other datatypes such as ints. What kind of math? What kind of other type of…
user3060854
  • 600
  • 4
  • 9
  • 20
10
votes
4 answers

Is there an Apple Silicon (M1) driver for CH34x devices?

I just migrated to a new computer running on an M1 CPU (the new Apple Silicon, arm64 based). I've been searching for CH34x drivers for my TTGO-Lora32 board, but can't find any around, nor can I find mentions of them existing or not. The x86_64…
finitud
  • 250
  • 1
  • 2
  • 9
10
votes
4 answers

How do you handle sensor drift?

I have a pair of potentiometers, on the Arduino, the output seems to drift, by one or 2 digits, back and forth. I would prefer they were read as one fixed value, without variation when their knobs are not turning. You can see in the image, the first…
j0h
  • 902
  • 4
  • 12
  • 30
10
votes
1 answer

Why is our refresh rate consistently decreasing in logging on SD card?

The current code is used to gather the state of 12 infrared beams and log them to an SD card using the real time clock to mark the time. The code uses a switch to turn the device on and off and an LED to indicate if data is being written to the SD.…
JClark
  • 103
  • 5
10
votes
3 answers

Arduino time keeping using millis() is not accurate or correct?

I have been using the Arduino to record some data. In my Arduino sketch I also used the millis() function so I can keep track of the time at which each value I am measuring is taken. However, I noticed that the timing isn't correct. For example 30…
hawkar
  • 553
  • 2
  • 6
  • 12
10
votes
5 answers

Efficient algorithm/data structure to calculate moving averages

Currently I am developing a graphic LCD system to display temperatures, flows, voltages, power and energy in a heat pump system. The use of a graphic LCD means that half of my SRAM and ~75% of my flash have been used up by a screen buffer and…
Cybergibbons
  • 5,420
  • 7
  • 34
  • 51
10
votes
1 answer

A digital I/O pin as ground

I want an I/O pin to return current in a circuit, similarly to the function of ground. Which of these will achieve what I require? pinMode(pinnumber, OUTPUT) digitalWrite(pinnumber, LOW) or pinMode(pinnumber, input)
rajat
  • 203
  • 1
  • 2
  • 7
10
votes
4 answers

Arduino motor shield orange/white pin usage

I have an Arduino motor shield like this one plugged into my Mega board. I would like to know some more information about the orange and white pin blocks on the board. The Arduino website has the following information, but it doesn't give any…
bladepanthera
  • 376
  • 2
  • 3
  • 14
10
votes
5 answers

formatting strings in Arduino for output

I wander what is the best option for formatting strings in Arduino for output. I mean what's a preferable way in the point of view of performance, memory usage – things like that. I see, people usually use direct Serial.print/println, like this: …
zhekaus
  • 459
  • 2
  • 6
  • 16
10
votes
1 answer

Arduino Convert std:string to String

I'm working on BLE project with espressif library. And It returns me founded BLE device. std::string getManufacturerData(); std::string getName(); int getRSSI(); BLEScan* getScan(); When I want to print device name to serial port…
BK52
  • 203
  • 1
  • 2
  • 4
10
votes
1 answer

Arduino IDE and subfolders

I have a sketch with multiple source files and folders arranged like so. I've divided up the project like this to keep things clean. | \---project | project.ino | types.h | +---sub1 | gadget1.c | gadget1.h …
user3404036
  • 101
  • 1
  • 3
10
votes
1 answer

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 ATSAMC21G18. I also have the Atmel/Microchip…
sa_leinad
  • 3,218
  • 2
  • 23
  • 51
10
votes
1 answer

Setting timer3 in CTC mode - conflict with servo library

I would like to set up a timer in order to call a function 800 times per second. I'm using the Arduino Mega and Timer3 with a prescaler of 1024. To choose the prescaler factor I've considered the following steps: CPU freq: 16MHz Timer resolution:…
UserK
  • 559
  • 1
  • 11
  • 24
10
votes
1 answer

Reading several rotary encoders

Have an upcoming project where user input will be based on spinning a large cog and I have several UNOs available Since rotary encoders need two pins, only a Mega would be able to handle the 7-8 encoders needed. Unless theres a better method of…
Andrew Lazarus
  • 243
  • 1
  • 2
  • 7
10
votes
1 answer

CH340 Nano avrdude: stk500_getsync() not in sync resp=0xa4

I'm trying to upload some code to an non-arduino nano with the CH340G chip, and the avrdude refuses to let me upload. The error I'm getting is: Using Port : COM4 Using Programmer : arduino Overriding Baud Rate …
Jacob
  • 219
  • 1
  • 2
  • 6