10votes
Accepted
Arduino Code for Talking to an RFID Reader
I see some things that may help you improve your program. The Arduino language isn't C++ The language used for the Arduino isn't quite C and isn't quite C++, so if your goal is to learn or improve ...
8votes
Accepted
Memory-optimizing arduino code to be able to print all files from SD card
The code has multiple possible points of improvement with respect to the Arduino Nano's memory limitations. Let's start by stating the current memory consumption. Compiling your sketch with PlatformIO ...
7votes
Interactive shell for Arduino
#define Don't use #define for constants! #define MAX_COMMAND_SIZE 30 should be: ...
7votes
Arduino library to simplify differential drive robots
General Observations The point of a library is to provide abstraction, reducing the amount of work that the user needs to do to accomplish what they want to do. This library does not provide any ...
7votes
Accepted
Arduino library to simplify differential drive robots
It's great that you have a library that works for you, but now you should think of redesigning it. I see that class DDBot is implementing the low-level ...
6votes
Accepted
Basic C++ IOT Weather Station
I'll assume the indentation is an artifact of pasting the code here. The big problem here is that long series of if statements. A simple improvement is to make ...
6votes
De/Serialize uint32_t from/to ASCII to use it in Arduino code
design of Public API bool sr( ... ) That is the Public API that you chose to define. That's what you're telling potential callers about your single responsibility. ...
5votes
Accepted
Interactive shell for Arduino
Since everybody here has already provided great suggestions. I am going to try and answer only the asked questions. Remove duplicate code: have internal function ...
5votes
Drift correction for sensor readings using a high-pass filter
Not a full review, just some design ideas: For a realtime system, I'd probably make the sampler object guarantee to produce valid values, rather than forcing all ...
4votes
Accepted
This program reads from serial port, Saves this to a text file, increments file name each time it is run
Welcome to Code Review, nice first question. Don't Panic, and always take a towel with you. General Observations This may be a copy and paste error, but the level of indentation is inconsistent. This ...
4votes
Digital clock with many functions
Just a single thing I noticed: if (not(row % 2) == 0) This code works, but only accidentally. You should have written either of these instead: ...
4votes
Digital clock with many functions
This looks like a really fun project! It's written in a fairly straightforward way, so I think I get most of it. Here are some suggestions for improving it. Avoid Magic Numbers You have a lot of ...
4votes
Read an image with ADNS2610 optical sensor and Arduino Uno
The pixel reading loop for( int i = 0; i < N_PIXELS; i++ ) leaves me uncomfortable. The data sheet effectively says that some reads may return ...
4votes
Accepted
Arduino Conways Game of Life using FastLED
First, given that this is C++, it's surprising that you're still using C-style #defines when you could be using constexpr ...
3votes
Accepted
Traffic Light which revolves around Serial Communication
Separate pin definitions Clearer and easier to maintain. ...
3votes
Accepted
Feedback on Traffic Light which revolves around Serial Communication
Use a common protocol file Any common constants, such as 9600 SYN, ACK, etc. strings should be ...
3votes
Accepted
Interlock of some equipments in electrical power system using simple Arduino Uno code
For embedded systems, don't use the native integer types of C, nor weird custom types like byte. Always use the types from ...
3votes
Accepted
Reading and Storing Integer from Serial Monitor
Character literals While this is technically correct: if (received != 10) // Terminate if newline char detected you're better off writing ...
3votes
Accepted
4x4 Matrix Keypad on Arduino UNO
Your general idea is correct - looping over columns to find out if one of them is active, and then only looping over the rows to find out which button was pressed will be somewhat faster (as in: more ...
3votes
Accepted
Arduino: Change the color & color intensity of a LED periodically
I agree that the switch statement smells. One way to avoid it is to abstract LED values into the array, and let change_color_intensity operate on it: ...
3votes
Accepted
Average readouts from multiple IR sensors with Arduino
The code feels overcommented. The only comment I see having some value is // Dummy sensor read (suggested when switching ADC pin) but even that shall refer to ...
3votes
Accepted
Arduino code and PING))) ultrasonic rangefinder
VeryLongIdentifiersInCamelCase do not make your code explicit. They just add noise. The definition ...
3votes
Arduino code and PING))) ultrasonic rangefinder
Am I not being to(o) explicit? Names are not too explicit, but verbose. Consider using standard physical units with metric units as the default: "meter, second, Volts, Amps, ...". Example, ...
3votes
Faster map function
The division is the real killer since the simple CPU doesn't have a divide instruction. Even in CPUs that do, it is very slow. If the denominator is known at compile time, the compiler can transform ...
3votes
Interactive shell for Arduino
From my experience working with Arduino or the AVR architecture in general is an exercise in trying to make sure everything you need will actually fit in memory, both RAM and flash. The scary thing is ...
3votes
Bare minimum implementation of Dallas 1-wire DS2401 slave for ATtiny9
Comments I have several comments about the code comments. I see that you spent great effort to carefully align the end-of-line comments; however, there is too much wasted horizontal whitespace. This ...
2votes
Arduino Adafruit Motor Shield v2 wrapper for parsing text into commands
Avoid regular expressions Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems. -- Jamie Zawinsky Your problem is simple enough that ...
2votes
Accepted
Vertical "moving" text on a LCD-display
waitUntilClear is always 0 when clearScreen is false ...
2votes
An interface for designing Arduino code
You describe what you did but you did not sufficiently describe why you did it. What problem you are trying to solve by your design? I see some major problems in your design. Uno.h does not need <...
2votes
Read an image with ADNS2610 optical sensor and Arduino Uno
Don't use #define for constants or "functions" (⧺ES.31). ⧺Enum.5 Don't use ALL_CAPS for enumerators and ⧺ES.9 Avoid ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
arduino × 91c++ × 52
c × 21
serial-port × 13
beginner × 12
performance × 11
device-driver × 7
python × 6
embedded × 6
algorithm × 3
serialization × 3
raspberry-pi × 3
c# × 2
javascript × 2
object-oriented × 2
multithreading × 2
node.js × 2
assembly × 2
library × 2
timer × 2
memory-optimization × 2
state-machine × 2
bluetooth × 2
java × 1
python-3.x × 1