Skip to main content
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 ...
Majenko's user avatar
  • 106k
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 ...
gbg's user avatar
  • 518
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 ...
dannyf's user avatar
  • 2,780
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 ...
Nick Gammon's user avatar
  • 38.7k
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: #...
Majenko's user avatar
  • 106k
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.
Daniel Thackeray's user avatar
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!
Starter's user avatar
  • 153
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) ...
Kwasmich's user avatar
  • 1,513
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 ...
Majenko's user avatar
  • 106k
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 ...
Edgar Bonet's user avatar
  • 44.3k
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 ...
Hasan's user avatar
  • 1,486

Only top scored, non community-wiki answers of a minimum length are eligible