Questions tagged [code-optimization]

The process of improving the efficiency of a program such that is uses less memory and/or less computational time.

10 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
176 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
0answers
126 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 ...
1
vote
0answers
1k 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 ...
0
votes
0answers
26 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 ...
0
votes
0answers
42 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 ...
0
votes
0answers
232 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 ...
0
votes
0answers
48 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 * ...
0
votes
1answer
92 views

Arduino Mega prototype analog timer interrupts: newbie question

I am currently using an Arduino Mega with a fast vibration sensor to trigger the components operation (force sensor, temperature sensor) and also toggle sleep mode. I am very new at this and I have ...
-1
votes
1answer
233 views

Optimizing for speed using const, static, constexpr etc in a function

In an ISR I want to keep things quick. At the same time I want to limit variable scope. Storage space is not a factor. I have this line: const char trigs[] = "aAbBcCdDeEfFgGhHiIjJ"; When this is ...
-1
votes
2answers
1k views

SD Library writing char in a file

I'm trying to write into a file using this code from the example of the library: String dataString = ""; int sensor = 0; dataString += String(sensor); dataString += ","; sensor +=1; File dataFile = ...