This gotcha still drives me crazy (newbies read)

"" if (TestBulb = 49) {""

So I get in the habit of using < or >, but even so, every now and then you will just use = and get stung.

How can I alter the compiler to not allow = by itself in the if statement?

(deleted)

Personally, I dislike it, but there is this way of doing the same thing that the compiler will catch for you:

if ( 49=TestBulb)

If you set File > Preferences > Compiler warnings to "All" or "More" then you get a warning from that code, which is a bit vague, but would likely cause you to see the problem:

ifbug:4:14: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

 if (TestBulb = 49) {}

I recommend always having your compiler warnings set to "More" and always paying attention to them. Unfortunately, sometimes that can be difficult when you're working with libraries or cores that generate a lot of warnings, which may make it difficult to notice the warnings in your own code. To take it a step further, you could upgrade the "suggest parentheses around assignment used as truth value" warning to an error using -Werror=parentheses. The way to accomplish this is to create a file named platform.local.txt in the same folder as the platform.txt file of each of the hardware packages you have installed that contains these lines:

compiler.c.extra_flags=-Werror=parentheses
compiler.cpp.extra_flags=-Werror=parentheses

Now that code will cause a compiler error:

ifbug:4:14: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]

 if (TestBulb = 49) {}

     ~~~~~~~~~^~~~

cc1plus.exe: some warnings being treated as errors

You will need to replace that file every time you update to a new version of any of those hardware packages.

If you need help locating the correct folders for your platform.local.txt, let me know.

I noticed earlier that you had another Thread aimed at Newbies.

IMHO it would be easier for Newbies to access your advices if you put them all in a single Thread.

...R

I will try that, thanks guys. As for the newbie thing, I'm just trying to save the some grief. put them all in one thread, well i can try i guess.

It does indeed give a warning, and I did have it set to all. And yes, it was buried in pragma warnings about bit banging. I googled pragma. Learned enough to not bother. So thanks again.

You might want to read through Arduino programming traps, tips and style guide.

that is a good tip sheet. on RAM availability tho, i just watch the numbers that the compiler issues and in some programs will easily have 4k of array and it seems to work, however that tip sheet says i have only 2k. How am i getting away with it?

How am i getting away with it?

Very simply, you're not.

sevenoutpinball:
And yes, it was buried in pragma warnings about bit banging.

Reference, please.

So anyway when the compiler burries messages under all this, they can be easy to miss. This is obviously only part of what it generates. I just have to be more careful and review all this stuff.

In file included from /Users/testlib/Documents/Arduino/TestWiFiGusher7/TestWiFiGusher7.ino:54:0:
/Users/testlib/Documents/Arduino/libraries/FastLED-master/FastLED.h:14:21: note: #pragma message: FastLED version 3.002.006

pragma message "FastLED version 3.002.006"

^
In file included from /Users/testlib/Documents/Arduino/libraries/FastLED-master/FastLED.h:65:0,
from /Users/testlib/Documents/Arduino/TestWiFiGusher7/TestWiFiGusher7.ino:54:
/Users/testlib/Documents/Arduino/libraries/FastLED-master/fastspi.h:110:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output

pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"

^
Compiling libraries...
Compiling library "NTPClient"
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/NTPClient/NTPClient.cpp.o
Compiling library "ESP8266WiFi"
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/ESP8266WiFiSTA-WPS.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/ESP8266WiFiSTA.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/WiFiClientSecureBearSSL.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/ESP8266WiFiAP.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/ESP8266WiFi.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/WiFiServer.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/ESP8266WiFiMulti.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/WiFiServerSecureBearSSL.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/ESP8266WiFiGeneric.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/ESP8266WiFiScan.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/WiFiUdp.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/WiFiClientSecureAxTLS.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/WiFiClient.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/CertStoreBearSSL.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/BearSSLHelpers.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/WiFiServerSecureAxTLS.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/ESP8266WiFi/ESP8266WiFi.a
Compiling library "FastLED-master"
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/FastLED.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/hsv2rgb.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/noise.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/wiring.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/bitswap.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/lib8tion.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/power_mgt.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/colorpalettes.cpp.o
Using previously compiled file: /var/folders/4b/sjd5y8t54zxdzx1q5vrk8lwm0000gn/T/arduino_build_688936/libraries/FastLED-master/colorutils.cpp.o
Compiling core...