Go Down

Topic: Commented Code has Adverse Effects (Read 968 times) previous topic - next topic

Iowaska

I think you need to make up your mind.
The point here is that debug statements and comments shouldn't effect code. If a system is that brittle, it's for the birds.

What is this sensor you are using? Link please.
I mean, the sensor doesn't seem to be the issue. I have tried a button, PIR, break sensor, and straight +. All work as desired with statements enabled. Commented, nothing works.

who said it isn't right or it's wrong?
who said caching a variable was harmful?

So much for:
Post was edited prior to your comment...

larryd

If you disconnect the sensor and use:

pinMode(SENSOR_PIN_1, INPUT_PULLUP);   

What happens?
      
No technical PMs.
The last thing you did is where you should start looking.

OldSteve

The point here is that debug statements and comments shouldn't effect code. If a system is that brittle, it's for the birds.
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.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

larryd

Assumption, is your sensor is wired similar to S3

No technical PMs.
The last thing you did is where you should start looking.

Iowaska

If you disconnect the sensor and use:

pinMode(SENSOR_PIN_1, INPUT_PULLUP);   

What happens?
      

No LED with either statements en/disabled. And also tried with DigitalWrite(SENSOR_PIN_1, INPUT_PULLUP);

Assumption, is your sensor is wired similar to S3


S3 is exactly how I have it wired, yes.

Iowaska

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...

larryd

Will you show us a good quality image of your wiring?
.
No technical PMs.
The last thing you did is where you should start looking.

OldSteve

I appreciate y'all giving it a whirl. I'm just lost for words...
I'll keep watching. I'll be most interested to see if the cause can be found.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Iowaska

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? 1.6.8.0?

:mystery:

larryd

#24
Mar 26, 2016, 03:33 am Last Edit: Mar 26, 2016, 03:34 am by LarryD
Don't you just love it when things do that  >:(

I use IDE  1.06  ;)
No technical PMs.
The last thing you did is where you should start looking.

Iowaska

Don't you just love it when things do that  >:(

I use IDE  1.06  ;)

I just started on a new machine so just downloaded it. But yes, things like this are the bane of my existence. Just like the damn Unity Mono compiler at one point in time caused huge heartache when somehow true == false. -.\

OldSteve

#26
Mar 26, 2016, 03:37 am Last Edit: Mar 26, 2016, 03:38 am by OldSteve
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? 1.6.8.0?

: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.)
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Iowaska

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.)
Yup, seems to work no problem...what a waste of a Friday night. hehe

cattledog

Works as expected with 1.6.6, which I am using, so the problem is in 1.6.7 or 1.6.8.

Go Up