November 21, 2024, 11:43:22 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


HALO themed cake - FINISHED

Started by Nannuu, June 09, 2007, 09:51:30 PM

Previous topic - Next topic

JonnyMac

June 22, 2007, 11:16:44 AM #15 Last Edit: June 22, 2007, 11:19:44 AM by JonnyMac
"Bad" is very subjective... I found your formatting and style a bit messy for my taste.  That said, I recognize that I may well be the most anal-retentive program formatter on the planet; this comes from having to program professionally and learning -- often, the hard way -- that messy formatting is the surest path to buggy code.  If you're interested in learning the rules of my style you can find them in a document called "The Elements of PBASIC Style" (yes, I wrote it).  You don't have to look for it as it's included in the BASIC Stamp Editor's help file.

The use of HIGH and LOW wasn't the problem, it was the way you were trying to implement LED timing that didn't work (at least on my Prop-1 when I ran it).

With two lines of code you can add a start signal for the module:
-- 1: Define a pin

SYBMOL  Sfx             = 7                     ' start sound module

Note that on the Prop-1 with the program you've been using you only have one output (P7/OUT7) left -- you can't use OUT0 - OUT2 as these will mimic the servo pulsing.

-- 2: Update the code that transitions from the LEDs being off to being on:

Leds_Off:
  PINS = %00000000                              ' clear leds
  IF ledTimer < 500 THEN Main                   ' still timing off-cycle
    ledTimer = 0                                ' reset timer
    updn = 0                                    ' set to on
    HIGH Sfx                                    ' activate sound module
    GOTO Main


How it works: At the end of the LED off cycle the SFX output is activated which will pull OUT7 to ground -- you can use this as a start signal for the audio player.  On the next loop cycle that pin will be cleared (by the first line in the Leds_On section); this means that the pulse to the audio board will be about 20 ms (plenty of time).

Connections: Your audio board should have some kind of push-button input.  One side of that will be ground, the other will normally be pulled high by a resistor on the board.  Connect the ground side of the push-button to the Prop-1 GND terminal and the high side of the button to the OUT7 terminal.  When the HIGH Sfx line runs the output will be on and the [Darlington] transistor in the ULN2803 will mimc pressing the button.  When P7 is cleared the button is "released."

Remember that the LEDs come on every 10 seconds so your audio should be a bit shorter than that; I'm not sure how the module will respond if it gets a start signal while playing.
Jon McPhalen
EFX-TEK Hollywood Office

Nannuu

You are THE MAN.  Thank you so much for the help.  I should be loading this up tonight for testing.  Just need to slap some resistors on my LEDs.  I think I'll also increase my timing between lights but I can handle that part for sure.  I think my audio will be fairly short, I'm going to pull it from the game and see how it sounds on the tiny speaker.

I'm going to look at my code again, I thought I had it.  Ha, I guess I should attempt to use my Prop trainer that's still sitting in its static bag  :P

JonnyMac

Yes, indeed, attach the Prop-1 Trainer whenever possible.  You didn't learn to decorate cakes without stuffing a few piping bags with frosting, did you?...  ;D
Jon McPhalen
EFX-TEK Hollywood Office

Nannuu

Weee hoo, it works great.  The only bad is that I realized I can't connect to my RS sound board without hacking up the board.  I'm not so interested in doing that yet.  Maybe I'll come up with another use of that extra output before everthing is together  :P
Now that I've hooked everything up and run it with a few changes (for fun), using the trainer should be really easy.  I imagined writing, compiling, loading, running, nothing works....go back re-write....
Thank you Jon.

JonnyMac

You're welcome -- please shoot and post video if you can.
Jon McPhalen
EFX-TEK Hollywood Office

Nannuu

Whoo hoo, the caked turned out very well.  A few mishaps but nothing that was a show stopper (some LED boards from All Electronics pooped out the night before the party).  Thanks for all of the help here.  You can see the Red, Green and Clear Master Chiefs are run by the random servos and the large center light is lit by the LEDs and Prop-1.

You can see the videos at Break or Youtube.  I'll update my website with a full write up later this week.

http://view.break.com/332913

http://www.youtube.com/watch?v=oO_YQ7T2ku4