I think you need to make up your mind.
What is this sensor you are using? Link please.
who said it isn't right or it's wrong?who said caching a variable was harmful?So much for:
The point here is that debug statements and comments shouldn't effect code. If a system is that brittle, it's for the birds.
If you disconnect the sensor and use:pinMode(SENSOR_PIN_1, INPUT_PULLUP); What happens?
Assumption, is your sensor is wired similar to S3
Well as far as I can see from my testing of your code, the debug statements don't affect the code or it's execution at all, except in the way you intended. Everything works fine for both cattledog's tests and mine, with or without the serial print lines and regardless of the state of the sensor input pin.I don't know what more to say, so I'll leave it to you and others to hopefully sort out.
I appreciate y'all giving it a whirl. I'm just lost for words...
Don't you just love it when things do that I use IDE 1.06
My phone isn't giving a good picture. However, I believe I have found the cause. I was toying with the preference and after unchecking "verify code after load" everything works peachy-king. IDE bug? 22.214.171.124?:mystery:
Yet another reminder of why I stuck with V1.6.5. It's the most reliable of all the recent releases. (I think 1.6.8 is the worst one so far.)Anyway, I'm glad you solved it. Edit: If I were you, I'd get rid of 1.6.8 and install 1.6.5. (That's just me though.)