AttachInterrupt breaking my code

if(someFlag) and if(someFlag == true) are functionally identical (I'm sure they even compile to the same machine code).

In professional code, you would never see the second variant because it would be considered an excessively verbose way to write this when the function of the alternative code is 100% clear to any experienced programmer. However, if(someFlag) might not be clear to a less experienced programmer while if(someFlag == true) is quite clear so I completely support the use of the more verbose variant in code that will be exposed to Arduino users since we put a focus on making embedded systems accessible to everyone.

No, it was purely a stylistic choice. There is no functional reason for writing it the way I did vs. your variant.

1 Like