3
votes
Accepted
A strange bug in my Arduino ALU
This is not a bug. It's just that you are working with signed 16 bit integers on an 8 bit microcontroller. The maximum an int can store is 32767, and literals are 16 bit signed by default.
Your three ...
3
votes
Accepted
Arduino Hanging Not sure if software or hardware issue
This is the UB!
The indexes in array in C++ counts from 0;
So, the last index in your array of 9 elements is 8.
All cycles must stop at 8. Yours are stops at 9.
Access beyond the existing element in ...
2
votes
Accepted
Why is integer-to-string not working in this sketch?
it took me a while and i'm still not 100% sure if I got you right. I think you have two questions:
1) how to speed up the entire execution?
the serial routines will be your biggest bottleneck. I ...
2
votes
Accepted
Function only taking the first 4 elements of a character array
You are passing a pointer (char str[]) and the sizeof operator is giving you the size of that pointer (4 bytes it appears in your case - on some Arduinos it would be 2 bytes).
The length of a ...
2
votes
"expected primary-expression before '.' token" in debug code
In short: you have your macro backwards.
Macros are not formed as "Take this set of commands and call it X" but "Make this macro X and have it equate to this set of commands".
Where you have:
#...
1
vote
DFPlayer Mini with its standard library does not being initialized
I simply removed the test for the return value of the constructor and assumed it initialised correctly. It then ran properly every time I started it. I have no explanation for this, but it worked.
1
vote
Accepted
DFPlayer Mini with its standard library does not being initialized
Please check if the RX/TX pins are messed up. In my case, simply RX and TX wires' places' switching did help!
1
vote
"expected primary-expression before '.' token" in debug code
You defined the pre-processor macro the wrong way around.
Think it is like an assign statement. You come up with a name and assign something to it.
#define SHORT_NAME(ARG) ...
1
vote
Accepted
How to use #define in a library I'm trying to write?
Anything in a header file that is included with #include is literally pasted into the file at the point of the #include.
So anything in your sketch you want to place into a header file you can just ...
1
vote
How to use #define in a library I'm trying to write?
Not a direct answer to your question, but I would suggest a different
approach based on streaming output, as described in the Arduino
Playground: Adding Streaming (insertion-style) Output. In
a ...
1
vote
Temperature sensor bugs
Here, below is updated version of your code.
Before running this code, you have to download DHT library. Just click on Click Here and you find good explanation & library of DHT11 Sensor. Becuase ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
debug × 20debugging × 8
arduino-ide × 5
arduino-uno × 4
serial × 3
arduino-mega × 2
library × 2
arduino-due × 2
software × 2
arduino-nano × 1
c++ × 1
led × 1
i2c × 1
motor × 1
esp32 × 1
string × 1
attiny × 1
array × 1
hardware × 1
compile × 1
code-optimization × 1
class × 1
iot × 1
rotary-encoder × 1
arduino-zero × 1