Magic Candles - Can't get the program to work
Halloween1
Posts: 5
I built the project from the October issue and for the life of me I can't get the program to work. I've worked with basic stamps for years and know the code inside and out and I thought I wouldn't have any problem trying out the propeller but I think I'm really missing something here. Help? Anyone?
Comments
This is the code that I am using right out of the project pages:
obj
leds : "jm_bam8"
pub main | ch, bright, delay
lottery := cnt
leds.init(WICK1)
bytefill(@level, 0, 8)
cognew(flicker(3), @stack)
repeat ch from 0 to 2
repeat bright from 0 to 255
pause(4)
level[ch] := leds.ezlog(bright)
pause(2000)
repeat
repeat bright from 255 to 64
pause(4)
bytefill(@level,leds.ezlog(bright),3)
flickerdelay := (255-bright) * 52 / 10
waitstart(150)
?lottery
delay := (||lottery//8001) + 2000
pause(delay)
flickerdelay := 0
repeat ch from 0 to 2
level[ch] := 255
pause(750)
pause(30000)
pri flicker(wix) | lotto, idx, tmp, direction {
}, base[8], target[8], ramp[8]
lotto := cnt
repeat idx from 0 to 7
target[idx] := ?lotto & $FF | $80
base[idx] := 0
ramp[idx] := (?lotto & %11) + 1
direction := %00000000
repeat flicker loop
?lotto
repeat idx from 0 to (wix-1)
if (ramp[idx] == 0)
ramp[idx] := (?lottery & %11) + 1
if (base[idx] < target[idx])
++base[idx]
elseif (base[idx] > target[idx])
base[idx]
else
direction := togglebit(direction,
idx)
if (getbit(direction, idx) == 0)
target[idx] := ?lotto & $FF | $80
else
target[idx] := ?lotto & $7F
tmp := (base[idx] * level[idx]) / 255
leds.set(idx, tmp)
if (flickerdelay > 0)
tmp := (flickerdelay * US_001) #> 400
waitcnt(tmp + cnt)
1. The "jm_bam8" is just another Spin program. I saw the article but did not read it closely. I suspect that this file is also listed out or downloadable. for simplicity, just put the JM_bam8.SPIN file in the same directory as the program you are working on.
2. When you post code to these forums, you need to wrap it with Code tags (see the '#') in the ribbon above the editing window. This will preserve the indentions. You will need to edit or repost so we can read the code.
WTF? no ribbon shows up above the reply editing window for me? I've been wondering what happened to the link, quote, image, etc. buttons.
I'm using Firefox 3.6.3 on Windows 7. But the editing ribbon is also missing on firefox on my home computer. (windows XP)
Lawson
Go to the "User CP' and click on "Edit Options". Scroll to the bottom and choose either "Standard Editor - Extra formatting controls" or the advanced one. Then the quick reply will show those formatting options.
Rich H
Ahh, ignore my ignorant post then!
Than you for the prompt reply. That is still way too hidden for an important setting like that.
I Started a thread over in the support forum on this. It also seems that the default post editor is the "basic" editor which lacks the quick links for adding markup to a message.
Lawson
P.S. I wasn't using the quick reply text box and buttons.