Questions tagged [code-optimization]
The process of improving the efficiency of a program such that is uses less memory and/or less computational time.
18 questions with no upvoted or accepted answers
2
votes
0
answers
88
views
Am I maximising my A0 readout rate with this peak-detection code?
I have a pulse going into A0 on a Nano, and want to detect the peak voltage. With low-pass filtering to slow down the input pulse I'm still reading marginally too slow.
The code overall inhibits a ...
2
votes
0
answers
2k
views
Sending data from webserver to Arduino
Hello Arduino enthusiasts! I've been working on a keypad lock system for school lately and I need some advice.Basically, my code checks if the entered passcode is the same than a predefined passcode ...
1
vote
0
answers
61
views
Sampling rate for Adafruit LSM6DSOX and Arduino MKR WIFI 1010
Please let me know if this post has the wrong tags, I will make sure to change it.
My goal is to get the highest sampling rate possible from the Adafruit LSM6DSOX (6667Hz) using the Arduino MKR WIFI ...
1
vote
0
answers
93
views
How do I optimize this IRremote code?
I am using a ATTINY85 Digispark board with an IR receiver to light some LEDs in my project. The Digispark has a limitation that does not allow it to use the IRremote.h library. I know that there a ...
1
vote
0
answers
69
views
Can a Windows 10 computer use Arduino IDE 1.8.10 sometimes AND use Arduino IDE 2.0.0 the rest of the time?
Can Windows 10 computer use Arduino IDE 1.8.10 sometimes, AND use Arduino IDE 2.0.0 the rest of the time?
1
vote
0
answers
1k
views
converting int or float into bytes array in arduino
I am trying to send data from one arduino to another over ethernet using udp protocol.
In arduino writing data over udp is like this
UDP.write(buffer, size);
where buffer is an array to send as a ...
1
vote
0
answers
955
views
How to stop my 16*2 lcd blink?
Here I wrote code for my weighting scale measurement. In which I added an on/off switch for my LCD display. But in defined delay time my LCD is a blink and I do not want it. I want my LCD switch on/...
1
vote
0
answers
75
views
Automatic water pump Trigger System - I need my code FIXED
int out = LED_BUILTIN;
int strt = 3;
int stp = 9;
void setup() {
pinMode(out,OUTPUT);
pinMode(strt,INPUT);
pinMode(stp,INPUT);
}
void loop() {
while(true) {
if(digitalRead(strt) == LOW) ...
1
vote
0
answers
1k
views
Reduce time between two consecutive SPI transfers on ESP32
I'm trying to drive an external DAC via SPI interface using ESP32 chip. But I cannot achieve the desired speed (>1M transfers/sec, each transfer consists of 16bits). The reason is not the SPI speed ...
1
vote
0
answers
53
views
Division with big constant number. Ideas to make it more efficient?
Im reading the voltage applied to my microcontroller using the internal voltage reference.
Here the topic is talked, and there are some working examples.
Im NOT using this examples, im using my own ...
1
vote
0
answers
118
views
Dragino Lora shield for Arduino sensor use
I am new to arduino and lora technology and i have dragino lorashield for arduino Uno and dragino gateway. I have also MQ-3 gas sensor and I want to detect the alcohol value and to send it to the ...
1
vote
0
answers
665
views
Optimizing Teensy 3.6 for data sampling?
So, I have a very basic project where I cycle through 8 IR individual transmitters. After setting the individual transmitter high, I cycle through all 8 IR receivers and print their values, RX_CYCLES ...
1
vote
0
answers
80
views
Combining sketches
I have two codes for my to sensors and they work separately. However, I need to combine them in one program please can you help?
The pulse code
/* PulseSensor Starter Project and Signal Tester
* ...
1
vote
0
answers
434
views
FIltering, FXOS8700, FXAS21002C optimization
I'm working on an inverse pendulum project, and am using an adafruit NXP_FXOS8700_FXAS21002 along with an Arduino due, and an esp8266 (two separate projects, same code however). I'm using a Magdwick ...
1
vote
0
answers
382
views
Why does the program size increase so drastically with these switch-cases?
EDIT: The problem is my op-code catch is op >= 0x20 || op <= 0x2F rather than op >= 0x20 && op <= 0x2F and so most of the switch-case was being optimised away!
This is a really ...