Hi,
I am having an issue with this error and I have no idea how to fix it. The code is to measure the battery voltage and turn on a led lamp based on voltage. But I haven't reached the led part yet. Kindly advise on where I am going wrong with the else if loop.
...and there's no need to set pinMode for an analogue input, "voltage" should be "const byte", and there's no need for "bms_voltage" to have global scope.
And the value of "bms_voltage" (assuming you remember to analogRead (voltage) ) is nearly always going to be zero.
If it isn't zero, it'll be 100.
True, but I always write it anyway because it captures the design intent, which is important if porting to a different platform with different default behaviours.