I’d like to turn on a light, and set its brightness based on the time. It seems like the cleanest way to do this would be with an ‘if’ statement like this:
This will always set the brightness to ‘77’ because the variable definitions in the ‘if’ statement are local to that scope. Is there some way around this, resetting those larger-scope variables to a new value?
Just my extra 2 cents, but reading your code, and intent, I’m thinking you might have a higher problem than that.
You seem to want to “default” to 77, but your if condition would never allow that, it would always be either 30 or 100.
Which basically, could be written like this, without variables/template at all: