Skip to main content

Questions tagged [code-optimization]

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

19 votes
5 answers
191k views

I'd like to make three arrays of the same length. According to the documentation, Arrays must be defined as int myArray[10]; where 10 can be substituted for a known length (another integer), or filled ...
user3.1415927's user avatar
12 votes
5 answers
4k views

Excuse me if it is a silly question, but I couldn't find an answer. I've been wondering for a while whether an Arduino (or generally any other micro-controller) gets happy if the code is light and ...
ahmadx87's user avatar
  • 549
9 votes
1 answer
1k views

When I compile my code, the Arduino IDE returns the binary sketch size in byte. Is there a good way to find out (approximately) what function or what part of my code takes up how much memory in ...
fuenfundachtzig's user avatar
8 votes
4 answers
4k views

While doing big projects using Arduino boards (Uno, Atmega328P MCU). I used to get warnings like this Sketch uses 13764 bytes (44%) of program storage space. Maximum is 30720 bytes. Global variables ...
Mayoogh Girish's user avatar
7 votes
4 answers
1k views

I'm trying to squeeze code onto an ATtiny10, but I'm just not getting there. I'm using 1060 bytes and only have space for 1024 bytes. The code is simple enough; I need to read a button pin. If high it ...
Earthbound Ruben's user avatar
7 votes
4 answers
3k views

I recently noticed how the map() function in Arduino was bulky in both terms of flash space used and time taken to execute, largely because it deals with long and involves a division and ...
Cybergibbons's user avatar
  • 5,430
7 votes
4 answers
3k views

I want to store a few (8 as of now) IR codes into my Board's EEPROM. It would be great if someone could suggest a few tips to maximize the lifetime. The IR codes in my sketch are saved in array of ...
karx's user avatar
  • 235
7 votes
2 answers
573 views

When you have really small snippets of code that are repeated several times in your micro controller program, is it better to write a method? I mean better in terms of performance and storage usage. I ...
Lehue's user avatar
  • 193
6 votes
2 answers
564 views

I'm having some trouble conceptualizing how to go about implementing PID into my drone. There are a few ways I'm thinking about implementing the pipeline: Having one PID Object for each of the six ...
tuskiomi's user avatar
  • 205
5 votes
3 answers
4k views

I have been working on an arduino program, which has gotten rather large. I am close to hitting the 32k limit on Flash for my ATmega328p. I would like lower my program size by saving some of my many ...
riverrun's user avatar
5 votes
1 answer
3k views

I am running out of code and data memory space on ATMega328P. Code size is big as I used several libraries, but, I only use a few functions of those library. Apparently, the default IDE is only ...
EEd's user avatar
  • 904
4 votes
2 answers
2k views

Im trying to move a servo from one place to another while using the typical for loop you find in the servo's library example: int lightON = 180; int lightOFF = 90; for (pos1 = lightOFF; pos1 <= ...
Marcelo_M's user avatar
  • 121
4 votes
1 answer
621 views

I am writing a GUI using a TFT display and the Adafruit GFX library and its default font on Arduino Nano. I want to be memory efficient and I assumed that the 'optimise for size' default setting of ...
WildCat's user avatar
  • 323
4 votes
4 answers
27k views

I was creating Arduino function which sends two int and additional chars between them and at the beginning and end of char array - then print that array to the serial port in almost real time. (For ...
ErnestW's user avatar
  • 109
4 votes
2 answers
413 views

I'm working on a project with a Digispark ATTiny85, that performs keystrokes using the DigisparkKeyboard library (https://github.com/digistump/DigisparkArduinoIntegration/tree/master/libraries/...
emma.makes's user avatar

15 30 50 per page
1
2 3 4 5
9