Quote Originally Posted by grahamg View Post
Can you please tell me what the following line of code does:
GPIO.0(x) = !!(LoopLED(x) < OnTime(x))
It is equivelent to ...
Code:
IF LoopLED(x) < OnTime(x) THEN
    GPIO.0(x) = 1
ELSE
    GPIO.0(x) = 0
ENDIF
What you would like to do is a direct assignment of a True/False comparison to a variable.
Code:
GPIO.0(x) = LoopLED(x) < OnTime(x)
But LoopLED(x) < OnTime(x) is a "Logical" expression that can't be assigned to a BIT variable.

The bitwise NOT operator (!) can convert the logical expression to a bitwise expression that can be assigned to a BIT variable.

A single ! will invert the result, so a second ! is used to invert it back.
Somtimes you want the result inverted, and you can use a single !.
Other times you might invert the logic of the comparison, use a single !, which gives you a non-inverted result.