Why do all 3 leds blink at same rate ?
Not sure why my previous post never made it to the forum..... hopefully this one will...
I am brand new to the propeller.... like the idea of 8 'cogs'.....
How come the following code has the result of all 3 leds blinking at the same time..... verses each of them 'twinkling' at their own rate as I thought the program specifies....
FYI... I originally had the Twinkle method as PUB... but get the same results
I am an accomplished MCU developer.... but not on Propeller... so thanks for being patient.
TJ
I am brand new to the propeller.... like the idea of 8 'cogs'.....
How come the following code has the result of all 3 leds blinking at the same time..... verses each of them 'twinkling' at their own rate as I thought the program specifies....
CON
_clkmode = xtal1 + pll16x 'Establish speed
_xinfreq = 5_000_000 '80Mhz
OBJ
led: "E555_LEDEngine.spin" 'Include LED methods object
VAR
byte Counter 'Establish Counter Variable
long stack[90] 'Establish working space
PUB Main
cognew(Twinkle(16,clkfreq/150), @stack[0]) 'start Twinkle cog 1
cognew(Twinkle(17,clkfreq/200), @stack[30]) 'start Twinkle cog 2
cognew(Twinkle(18,clkfreq/250), @stack[60]) 'start Twinkle cog 3
PRI Twinkle(PIN,RATE) 'Method declaration
repeat 'Initiate a master loop
repeat Counter from 0 to 100 'Repeat loop Counter
led.LEDBrightness(Counter, PIN) 'Adjust LED brightness
waitcnt(RATE + cnt) 'Wait a moment
repeat Counter from 100 to 0 'Repeat loop Counter
led.LEDBrightness(Counter,PIN) 'Adjust LED brightness
waitcnt(RATE + cnt) 'Wait a moment
FYI... I originally had the Twinkle method as PUB... but get the same results
I am an accomplished MCU developer.... but not on Propeller... so thanks for being patient.
TJ

Comments
Delete Counter from the VAR section.
I'm not sure if that will solve the problem. It just jumps out at me.