All Questions
Tagged with code-optimization programming
13 questions
0
votes
1
answer
1k
views
Optimised random alphanumeric string generator
I'm trying to build arduino nonce generator, but the only thing I found is this question on arduino forum but I can't find out how to make it work for me. I checked and Serial.available() is always 0 ...
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 ...
8
votes
4
answers
4k
views
What are the traditional ways to optimize program memory usage?
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 ...
0
votes
1
answer
101
views
Modular Coding - What types of code portions to convert into library files? Rationale and methods?
I'm working on documentation and combining 2 pieces of code for testing parts of a larger project.
I'm supposed to comment and make the code very clear to people who will use it later and make sure ...
-1
votes
1
answer
142
views
Refactoring bad design?
Could someone help me how to refactor old very complex code ?
Original used just setup and everything else was in single ISR.
But as it was bigger and bigger, code is quite slow and quite random ...
7
votes
2
answers
573
views
Storage usage of methods compared to copied code
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 ...
0
votes
1
answer
710
views
Switch Statement Alternative
I am working on a project where I've mapped an IR remote control to certain functions. I am currently using a massive switch statement to control the program based on the IR remote button pressed.
Is ...
3
votes
1
answer
2k
views
OOP vs procedural programming on arduino
It seems like the majority of Arduino applications are written without using classes / objects. Is there a reason for this? Does is slow down the Arduino or somehow present undesirable behavior?
0
votes
2
answers
92
views
Interrupt numbering
I'm using an Arduino Mega and four of its interrupts. Each interrupt is only used to start/stop a timer, depending if it's rising or falling, so effectively runs the same function. Does anyone know if ...
-3
votes
1
answer
170
views
How do I learn C? (was Computer project) [closed]
Can you help me writing a code for this question guys??
You have an Arduino Uno with 8 LEDs connected to digital pins 2 to 9.
Create an array of 8 elements. Fill it with random numbers between 2 and 9 ...
0
votes
1
answer
117
views
Sweep with two shift registers
I am working with 8 dual color LED's and 2 shift registers. My connections are in place. But I do not understand how to work with 2 shift registers.
So I am trying to make this: turn the first led on,...
0
votes
2
answers
455
views
releasing memory in sub-function
I'm doing a program who get a line from the SD and shows it, this function is called getData()
FULL CODE:
#include <SD.h>
#include <MemoryFree.h>
File myFile;
int stringIndex = 0;
int ...
19
votes
5
answers
191k
views
How can I declare an array of variable size (Globally)
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 ...