Code:
FOR LoopCount = 1 TO 4              ; Reapeat 4 times
        FOR DutyVar1 = 0 TO 150         ; Fade LED1 UP
            PAUSE 10
            RANDOM  RandVar             
            DutyVar3 = RandVar & $3F    ; Give LED3 a random dutycycle
        NEXT DutyVar1
         
        FOR DutyVar1 = 150 TO 0 STEP -1 ; Fade LED1 Down
            PAUSE 10
            RANDOM  RandVar
            DutyVar2 = RandVar & $3F    ; Give LED2 a random dutycycle
        NEXT DutyVar1
    NEXT LoopCount
If I follow the example above all the processing (for want of a better word) is done in a loop, so once DutyVar1 has had its value written to the port, it then moves on to DutyVar3 and does the same and then to DutyVar2, then loops back round and does then runs through the loop again adding or subtracting (or inserting a random value), then loops back .... etc etc.

Is there a way of having all three LEDs running in independent loops so that led1 doesn't have to wait for led3 to be actioned before having the next value written to it ? Or are we entering the realm of your PID routines that Darrel used to help me develop my 4ch reptile thermostat ??

Cheers

Malcolm