Shop OBEX P1 Docs P2 Docs Learn Events
Magic Candles - Can't get the program to work — Parallax Forums

Magic Candles - Can't get the program to work

Halloween1Halloween1 Posts: 5
edited 2010-10-12 16:15 in Propeller 1
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

  • SeariderSearider Posts: 290
    edited 2010-10-12 02:44
    It would help if you post some more details about what works, what dosn't, what you have tried. Also posting your code would help. It is very common for people new to the propeller to fail to appreciate the importance of proper indention in the source code. Without anything to go on, take a look at that.
  • Halloween1Halloween1 Posts: 5
    edited 2010-10-12 04:44
    My biggest hangup right now is with the jm_bam8 object, I get an error that says the file does not exist, I guess I don't understand the bam files.

    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)
  • SeariderSearider Posts: 290
    edited 2010-10-12 04:51
    A couple of things

    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.
  • Halloween1Halloween1 Posts: 5
    edited 2010-10-12 05:04
    Let's try that again...
    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)
    
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-10-12 05:25
    I've attached my original files. Not sure why you didn't download jm_bam8 in the process of getting the main file, because I know others have.
  • Halloween1Halloween1 Posts: 5
    edited 2010-10-12 07:24
    Got it and it works great, looks like I was missing a lot of stuff. Thanks guys for the help and thaks to Jon for the project. Great job!
  • LawsonLawson Posts: 870
    edited 2010-10-12 09:53
    "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
  • Shawn LoweShawn Lowe Posts: 635
    edited 2010-10-12 10:59
    Quick reply wont show the ribbon
  • W9GFOW9GFO Posts: 4,010
    edited 2010-10-12 11:56
    Lawson wrote: »
    But the editing ribbon is also missing on firefox on my home computer. (windows XP)

    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
  • Shawn LoweShawn Lowe Posts: 635
    edited 2010-10-12 13:41
    W9GFO wrote: »
    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!
  • LawsonLawson Posts: 870
    edited 2010-10-12 14:49
    W9GFO wrote: »
    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


    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.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-10-12 15:09
    Is anybody moderating? -- this thread has become seriously hijacked....
  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-12 16:15
    Please do keep replies relevant to the original subject of the thread. I know that it's easy for the subject to drift without meaning to, but please keep that to a minimum or start your own thread. Thanks.
Sign In or Register to comment.