Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Hot answers tagged

2

The return value of strcmp does not have boolean semantics, as you seem to incorrectly assume. strcmp is a tri-state comparator, which returns negative, zero or positive value. For equal strings it returns zero, which means that an equality comparison with strcmp should normally look as follows if (strcmp(str1, str2) == 0) Serial.println("Equals"); else ...


2

std::array does not use dynamic memory allocations to store its elements. If you use static or stack-allocated std::arrays, you don't have to worry about memory fragmentation (contrary to std::vector or String, for example). Of course, if you allocate arrays on the stack, you can have a stack overflow if you call too many functions, either by design, or ...


1

I back up Michel Keijzers' suggestion to use a plain array, especially given the tiny amount of RAM in your MCU (only 256 bytes). Concerning the removal of items from the list, and given that your list will be 16 bytes at most, you don't need to get fancy: just move back the items that are past the one you removed. It will not take long. Here is a ...


1

I don't think that this library is supported by attiny (or even Arduino in general). However, beyond that, it is not advised to use it, since it is uncertain how much memory and flash overhead it consumes. Especially the memory is an issue for two reasons: Internally, you don't know the exact data structures used for the list. In most efficient way, it ...


1

I see two issues with this program. The first one has already been pointed out by Majenko in a comment: you are doing too much floating point calculations. The second has to do with the way your Phasor manages the time. If you take a look at the Blink Without Delay Arduino tutorial, you will see something along these lines: if (currentMillis - ...


1

Seems like you are using the system clock micros() to calculate elapsedTimeMicros, so probably the time spent on the process of calculation and sending signal to the pin may affect it, which may lead to inconsistent duty cycle.


1

Leaving this here in case anyone else has a similar issue as an "answer" to my own question: Simply put - DHT11 library as used, and MQTT library as used conflict. That's it, that's the answer. There are two options for correcting this depending on your needs: don't use or deeply examine and rebuild one of the libraries - frankly this was a negative ROI ...


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