Guess you ignored the description of what's happening.
Imagine that.
Imagine that.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Ok, so what happens here? Led1On starts at 0. When the Counter value equals 0, three things happen:
¤ LED1 is turned on
¤ LED1On is set to 20
¤ LED1Off is set to 10
When the Counter = 10, LED1 will be turned off.
When the Counter = 20, the sequence repeats.
LED1 is on half the time, off half the time, so the brightness is 50%. This is kind of crude; making it a subroutine (do not call this a sub route. That is gibberish.) would be cleaner.
You are definitely proving that.but I'm a champion of lost causes.
You are definitely proving that.
Mike.
While 1 = 1
// some code will go here
If Counter = LED1On Then //first pass led1 = 0
LED1 = 1 // led1 is on
LED1On = Counter + 20
LED1Off = Counter + 10 //first pas led1 = 10
End If
//xxxxxxxxxxxxxxxxxxxxxxxx
// led testing indicators
if counter = 20 then
led2=1 // process indicator
end if
if counter = 10
then led3 = 1
end if
delayms(1000) //slow it down to see what is happening
//xxxxxxxxxxxxxxxxxxxxxxxxxx
If Counter = LED1Off Then
LED1 = 0
End If
Inc (Counter)
If Counter > 4000 Then // 4000000000
Counter = 0
led3 = 0 // process indicator
End If
Wend
I understand what you are doing but IMO you made it more complex than it needs to be
have typed your code and going to run it later today
You made it more complex by adding ledoffcount etc.
If PORTB.0 = 0 then
PortB.7 = 1
Else
PortB.7 = 0
End If
//vs
If S1 = Pressed then
LED1 = LEDOn
Else
LED1 = LEDOff
End If
the code in post#108 will fade in and out multiple leds. No they are not included in post#108. With some rearanging it will fade in and out multiple leds at different rates if desired