November 24, 2024, 01:08:02 AM

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.


So I've perused all the coding for the typical Casa Fear Ground Breaker...

Started by nfmmalice, October 19, 2011, 04:03:40 PM

Previous topic - Next topic

bsnut

Quote from: nfmmalice on October 25, 2011, 08:35:46 PM
Just one more clarification...

If I run it on position 2....  To power the 24vdc solenoids...  Will that affect the fog trigger?
You need to run in position 2 in order to power the your solenoids. If you don't want it to affect the fogger trigger don't connect to the OUTx that is for the fogger or you can comment code out of your program like this, that is related to the fooger.

'FogCtrl = IsOn
William Stefan
The Basic Stamp Nut


bsnut

If you are talking about the fogger, then yes. Just remember that your fogger trigger needs to be connected through a relay. What I am saying is that fogger relay coil gets connected to V+ and OUT0 and the relay contacts to the fogger circuit. 
William Stefan
The Basic Stamp Nut

JackMan

QuoteIf I run it on position 2....  To power the 24vdc solenoids...  Will that affect the fog trigger?

If you power the Prop-1 with 24v and the switch is in position 2, any device that you connect to V+/OUTx has to be 24v as well. So your fogger relay must be 24v, if it isn't, you'll need to wire in another 24v relay to the fogger circuit.

dullom

I too need some Zombie Thrasher programming help if anyone would like to change this programfor me.

I want to remove the AP8 audio, and replace it with it a 12v cowlacious audio board on pin5 and need it to run 15 seconds. LED can be removed as well. I would also would like a 60 second delay before the program restarts again. I attempted to change these things on the the program and messed it up....  ::)


So, if anyone wants to give it a whirl, this is what I need.

1. Remove AP8 from Pin 7

2. Place Cowlacious audio on pin5. It needs to start with the shoulders, and run and run it for 15 seconds. It can be labled as Audio

3. Trigger on pin6 is still PIR

4. Remove LED on pin3 from program

5. Leave Shoulders on pin0 and pin1 in program. They are fine. JUst need to rund 15 seconds.

6. Put in a 60 second pause before program restarts again.


' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Modified..
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; No ULN
SYMBOL  Trigger         = PIN6                  ' ULN is pull-down
SYMBOL  LED             = PIN3                  ' use V+/OUT3 terminals
SYMBOL  Shoulder2       = PIN1                  ' use V+/OUT1 terminals
SYMBOL  Shoulder1       = PIN0                  ' use V+/OUT0 terminals


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

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0                     ' put back to low/off

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' baud serial

SYMBOL  ThrashTime      = 15000


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

SYMBOL  idx             = B2
SYMBOL  valves          = B3
SYMBOL  last            = B4

SYMBOL  sfx             = B5
SYMBOL  lastsfx         = B6

SYMBOL  delay           = W4
SYMBOL  timer           = W5
SYMBOL  lottery         = W6


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

Power_Up:
  PAUSE 250

Reset:
  PINS = %00000000                              ' preset IO pins
  DIRS = %00001011                              ' define IO pins

  SEROUT Sio, Baud, ("!AP8", %00, "X")          ' stop audio
  PAUSE 30000                                   ' 30s inter-show delay


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  RANDOM lottery                                ' randomize lottery value
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' inc or clear timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input


Start_Audio:
  RANDOM lottery                                ' stir random #
  sfx = lottery // 3                            ' 0..2
  IF sfx = lastsfx THEN Start_Audio             ' don't repeat
    lastsfx = sfx                               ' save for next time

  sfx = sfx * 3                                 ' convert to slot #
  SEROUT Sio, Baud, ("!AP8", %00, "P", sfx)     ' start audio


Jump:
  PINS = %00001011                              ' led + shoulders on
  PAUSE 1000

Thrasher:
  FOR idx = 1 TO 3                              ' big stir
    RANDOM lottery
  NEXT
  valves = lottery & %00000011

  IF valves = last THEN Thrasher                ' no repeats
    last = valves                               ' save for next cycle

  PINS = valves | %00001000                     ' update shoulder outputs
  RANDOM lottery                                ' restir
  delay = lottery // 251 + 100                  ' delay 100 to 350 ms
  PAUSE delay
  timer = timer + delay                         ' update timer
  IF timer < ThrashTime THEN Thrasher           ' thrash for 10 seconds
    GOTO Reset


Thanks in advance for your help guys! -Dave

bsnut

Dave,

What you want to is easy to do. I just remove code related to the AP-8 and a Pause 60000 under the label Reset.

BTW, You should have started a thread related to your program and it makes it easier for us to follow and confuses others. But, that is ok for now

Here's your modified code. 

'=========================================================================
'
'   File......Casa Fear Ground Breaker v1.bs1
'   Purpose...Control a Casa Fear Ground Breaker Prop
'   Author....
'   E-mail....
'   Started...Oct 26, 2011
'   Modified..
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; No ULN
SYMBOL  Trigger         = PIN6                  ' ULN is pull-down
SYMBOL  Audio           = PIN5                  ' use V+/OUT5 terminals
SYMBOL  LED             = PIN3                  ' use V+/OUT3 terminals
SYMBOL  Shoulder2       = PIN1                  ' use V+/OUT1 terminals
SYMBOL  Shoulder1       = PIN0                  ' use V+/OUT0 terminals


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

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0                     ' put back to low/off

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' baud serial

SYMBOL  ThrashTime      = 15000


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

SYMBOL  idx             = B2
SYMBOL  valves          = B3
SYMBOL  last            = B4

SYMBOL  delay           = W4
SYMBOL  timer           = W5
SYMBOL  lottery         = W6


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

Power_Up:
  PAUSE 250

Reset:
  PINS = %00000000                              ' preset IO pins
  DIRS = %00101011                              ' set P5, P3, P1, P0 to outputs

  PAUSE 60000                                   ' 30s inter-show delay


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  RANDOM lottery                                ' randomize lottery value
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' inc or clear timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input


Start_Audio:                                    'Cowlacious Audio start pulse
  Audio = IsOn
  PAUSE 250
  Audio = IsOff


Jump:
  PINS = %00001011                              ' led + shoulders on
  PAUSE 1000

Thrasher:
  FOR idx = 1 TO 3                              ' big stir
    RANDOM lottery
  NEXT
  valves = lottery & %00000011

  IF valves = last THEN Thrasher                ' no repeats
    last = valves                               ' save for next cycle

  PINS = valves | %00001000                     ' update shoulder outputs
  RANDOM lottery                                ' restir
  delay = lottery // 251 + 100                  ' delay 100 to 350 ms
  PAUSE delay
  timer = timer + delay                         ' update timer
  IF timer < ThrashTime THEN Thrasher           ' thrash for 15 seconds
    GOTO Reset

William Stefan
The Basic Stamp Nut

dullom

Thanks for editing it for me.

My apologies. Next time I'll start a new thread.... Just didn't see a need for doing that since I was reading this thread, and asking for help on the very some subject. Seemed rather redundant to do that.

bsnut

That's what we are here for, to get you up and running for Halloween.
William Stefan
The Basic Stamp Nut

dullom

Quote from: bsnut on October 26, 2011, 01:36:41 PM
That's what we are here for, to get you up and running for Halloween.

I ran the program last night, and the audio still didn't work on pin5....

It did the same thing when I tried to edit the program, which is why I gave up and asked for some help (after spending several hours editing the program to make it run audio on pin5).

I also tested the Prop-1 with totally different program I have that is programmed to run audio on pin5, and it ran the audio just fine from it, so it's not the board.

Last night I got curious, and moved my audio wire to pin3, which is programmed for the LED. It turned on the audio with no issues.

Since the audio was already connected and worked, I just left it labled as LED, and ran it from pin3.

It works just fine for what I want, but for whatever reason, the audio on pin5 on the program you edited still does not want to turn the audio on at all.


bsnut

My bad. Must be a senior member moment :o. Thanks for testing and catching it.

The mistake was in beginning of the program in the Initialization section, where the DIRS are setup. Just make the DIRS look like what I below.

DIRS = %00101011           'set P5, P3, P1, P0 to outputs
William Stefan
The Basic Stamp Nut

dullom

Quote from: bsnut on October 27, 2011, 12:11:28 PM
My bad. Must be a senior member moment :o. Thanks for testing and catching it.

The mistake was in beginning of the program in the Initialization section, where the DIRS are setup. Just make the DIRS look like what I below.

DIRS = %00101011           'set P5, P3, P1, P0 to outputs



Ahhhh yes, now I see it. I needed to change some of the ones and zeros, so they're set to be on or off...  I'll test the program this weekend to see how it works. Thanks again for editing it for me!