I have written the below code for controlling an RGB LED in regards to a tempreture reading from an attached sensor, however I'm having difficult in "resetting" the RGB values if you will, it seems to stay blue at the moment regardless of a tempreture below 20, my temp is a float value if that would change things, thanks in advance. -Sam
The code executes and compiles, It doesn't go the colors i'd expect, I've currently got it to a point of flashing red but it then goes back to blue, it's as though it doesn't stop on the IF statement
Ah yes - neither of them is any guarantee that the code will do what you wanted it to do!
There are many ways to write code that is syntactically valid (ie, compiles OK), but does not actually do what you wanted - just like a spell checker can tell you that all the words in a document are correctly spelled, but that doesn't mean they are the correct words, or that the text makes any sense!
For example:
That is syntactically valid, but I don't think it's what you want at all:
@LarryD pointed out that you probably don't want the semicolon there;
I pointed out that you probably should have an if in there.
Yep I was wrong, I must have made some changes to the code breaking it before posting, without sounding like i'm not grateful for the help you providided, I did find the solution to my problem which was finishing my IF statement with an else writing each pin back to 0 value.