I think you're on your own from here.....
Ain't nobody crazy enough to try and unravel this crap.
Ain't nobody crazy enough to try and unravel this crap.
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.
While TRUE
Index = 1
Repeat
Index = Index +1
led2 = 1
DelayMS(500)
led2 = 0
DelayMS(500)
Until Index >= 10
DelayMS(5000) //indicates the change over from timed out
Index = 1
Repeat
Index = Index +1
led1 = 1
DelayMS(500)
led1 = 0
DelayMS(500)
Until Index >= 5//4294967200
DelayMS(5000)
Wend
The only difference is how many times the repeat-until loop can run (the 'until index >=' statement).here is the SIMPLE LOOP that works and tried seeing if BYTE instead of LONGWORD worked the same.
Sorry, blurry vision while waking up way too early4294967200 is almost 2^32. A longword will accept up to 2^32 - 1, or 4294967295.
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2022 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 5/21/2022 *
* Version : 1.0 *
* Notes : copy n pasted from
Report
rjenkinsgb *
* : *
*****************************************************************************
}
Device = 18F43K22
Clock = 8
// int osc and IO pin libraries
Include "intosc.bas"
#option DIGITALIO_INIT = true // automatically call setalldigital
Include "setdigitalio.bas"
Include "convert.bas"
DIM LED1 AS PORTA.0
DIM LED2 AS PORTB.0
DIM LED3 AS PORTC.0
DIM LED4 AS PORTD.0
DIM Time1 AS BYTE
DIM Time2 AS BYTE
DIM Time3 AS BYTE
DIM Time4 AS BYTE
dim counter as byte
led1 = 0
led2 = 0
led3 = 0
led4 = 0
Time1 = 10
Time2 = 25
Time3 = 50
Time4 = 75
cOUNTER = 0
trisa=0
trisb=0
trisc=0
trisd=0
While TRUE
// LED One control
if (Time1 > counter) then
led1=1
else
led1=0
endif
// LED Two control
if (Time2 > counter) then
led2=1
else
led2=0
endif
// LED Three control
if (Time3 > counter) then
led3=1
else
led3=0
endif
// Other LEDs here.
// Increment PWM cycle counter every loop
cOUNTER = (cOUNTER + 1)
// Check for overflow
If cOUNTER > 100 Then
cOUNTER = 0
// Add the fades etc. here.
End If
Wend
Time1 = 10
Time2 = 25
Time3 = 50
Time4 = 75
Counter = 0
While TRUE
// LED One control
if (Time1 > Counter) then
led1=1
else
led1=0
end if
// LED Two control
if (Time2 > Counter) then
led2=1
else
led2=0
end if
// LED Three control
if (Time3 > Counter) then
led3=1
else
led3=0
end if
// LED Four control
if (Time4 > Counter) then
led4=1
else
led4=0
end if
// Increment PWM cycle counter every loop
Counter = Counter + 1
// Check for overflow
If Counter > 100 Then
Counter = 0
End If
Wend
Time1 = 10
Time2 = 25
Time3 = 50
Time4 = 75
You funny guy! After seeing "it dawned on me that it looks like it is maybe using the PWM on the chip" I figured we'd be waiting a loooong time for that to happen.I was hoping MrDEB would take the trouble to figure that out.
I would think you'd be able to see it, but maybe the refresh is so fast it's hard to tell the difference?Note that he said all the LEDs are the same brightness, which is impossible.
Never knew that // was a comment in basic, thought it was a C thing. In basics I've used it's normally '//4294967200 is a comment, not a math statement. 4294967200 = 2^32. It's anyone's guess what MrDEB thinks it means.