November 21, 2024, 06:25:41 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Jon, Please help!

Started by dflowers, October 28, 2008, 09:12:18 PM

Previous topic - Next topic

dflowers

I know this is very simple, but I had a short little program that would runa simple pop up in a ff gallon drum and now I can't find it. I just need something to get me started and hopefully I can finish it by Halloween. This is my set up:

Prop-2 activated by a Parallax PIR. Once activated, Prop-2 turns on string of LEDs powered by 12v DC. Short time later, Prop-2 activates air solenoid that pops up the zombie from the drum. Air solenoid is powered by 12v DC. There is no sound or anything else that needs to the activated. Like I said, I know this is simple and my original code kept it from triggering multiple times in a short period, but at his point, beggers can't be choosers.

If you can help, i would be very appreciative.

Thanks,

Dorian

JonnyMac

October 29, 2008, 08:37:05 AM #1 Last Edit: October 29, 2008, 08:39:21 AM by JonnyMac
Here you go -- update timing as desired.  A 30-second delay in the Reset section prevents constant retriggering.

Note that I put your outputs on 8 and 9 to make the program compatible with a Prop-1 Trainer board.


' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 29 OCT 2008
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

Trigger         PIN     14                      ' SETUP = DN

Zombie          PIN     9
Leds            PIN     8


' -----[ Constants ]-------------------------------------------------------

IsOn            CON     1                       ' for active-high in/out
IsOff           CON     0

IsUp            CON     1
IsDown          CON     0

Yes             CON     1
No              CON     0


' -----[ Variables ]-------------------------------------------------------

timer           VAR     Byte
lottery         VAR     Word                    ' random #
delay           VAR     Word


' -----[ Initialization ]--------------------------------------------------

Reset:
  OUTH = %00000000 : OUTL = %00000000           ' clear all
  DIRH = %00000011 : DIRL = %00000000           ' set outputs

  PAUSE 30000                                   ' warm-up / delay


' -----[ Program Code ]----------------------------------------------------

Main:
  timer = 0                                     ' reset timer
  DO WHILE (timer < 100)                        ' wait for 0.1 sec input
    RANDOM lottery                              ' stir random #
    PAUSE 5                                     ' loop pad
    timer = (timer + 5) * Trigger               ' update timer
  LOOP

  Leds = IsOn

  RANDOM lottery
  delay = lottery // 2001 + 1000                ' 1 to 3 seconds
  PAUSE delay

  Zombie = IsUp
  PAUSE 3000                                    ' up for 3 seconds

  GOTO Reset                                    ' everything off


' -----[ Subroutines ]-----------------------------------------------------


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

dflowers

Jon,

Thank you so much! After looking at your code, I think I am better off that I lost mine. Thanks for making it compatible with the Prop-1 also. I purchased one of those before I purchased the Prop-2, but now I cannot find it. I guess these days I am losing everything.

Thanks,

Dorian

dflowers

Jon,

ok, so at the last minute I am trying to add a 2 second burst of fog after the LEDs. So far I have been unsuccesful. Can you take a look at my code and tell me what I am doing wrong?' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 29 OCT 2008
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

Trigger         PIN     14                      ' SETUP = DN

Fog             PIN     10
Zombie          PIN     9
Leds            PIN     8


' -----[ Constants ]-------------------------------------------------------

IsOn            CON     1                       ' for active-high in/out
IsOff           CON     0

FogIsOn         CON     1
FogIsOff        CON     0

IsUp            CON     1
IsDown          CON     0

Yes             CON     1
No              CON     0


' -----[ Variables ]-------------------------------------------------------

timer           VAR     Byte
lottery         VAR     Word                    ' random #
delay           VAR     Word


' -----[ Initialization ]--------------------------------------------------

Reset:
  OUTH = %00000000 : OUTL = %00000000           ' clear all
  DIRH = %00000011 : DIRL = %00000000           ' set outputs

  PAUSE 30000                                   ' warm-up / delay


' -----[ Program Code ]----------------------------------------------------

Main:
  timer = 0                                     ' reset timer
  DO WHILE (timer < 100)                        ' wait for 0.1 sec input
    RANDOM lottery                              ' stir random #
    PAUSE 5                                     ' loop pad
    timer = (timer + 5) * Trigger               ' update timer
  LOOP

  Leds = IsOn

  RANDOM lottery
  delay = lottery // 2001 + 1000                ' 1 to 3 seconds
  PAUSE delay

  Fog = FogIsOn
  PAUSE 2000

  Zombie = IsUp
  PAUSE 3000                                    ' up for 3 seconds

  GOTO Reset                                    ' everything off


' -----[ Subroutines ]-----------------------------------------------------


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------

livinlowe

Is the fog not coming on at all? It should but after the random 1 to 3 second delay.
Shawn
Scaring someone with a prop you built -- priceless!

dflowers

I am using the Prop-1 Trainer to see if the led for PIN 10 is activating and it does not come on. I have tested the Prop-1 Trainer to see if it will light at all and it works as expected using the trainer code for the Prop-2 controller. I have not actually hooked up the fog machine yet.

JonnyMac

You have the fogger on pin 10 but you didn't make it an output.  Change the value of DIRH to %00000111 -- this will make pins 8 - 10 outputs.
Jon McPhalen
EFX-TEK Hollywood Office

dflowers

Wow, yep, I overlooked that. Thanks, I feel a little dumb now. I did fix it in time for my Halloween display. Thanks.