November 22, 2024, 10:32:39 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.


writing a program

Started by djm902, October 19, 2008, 08:42:54 PM

Previous topic - Next topic

djm902

i was wondering if somone could write a program for me as i am still learning
how to program and its getting close to the deadline

livinlowe

What do you want the program to do?
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

Of course we're happy to write a program for you, and as Sean indicated, you have to let us know what the program has to do.  Be very specific with inputs, outputs, timing; you cannot give us too much information -- more information is better.
Jon McPhalen
EFX-TEK Hollywood Office

djm902

ok im going to be using output 1 and 2
out1 is for a audio chip
out2 is for a 12v solenoid
i would like to trigger 1 and 2 at the same time and hold 2 for five seconds
and then reset to the the the start
im goin to be using the uln2003an chip and powering  the audio chip
and the solenoid with  the prop one controller.
if any of this sounds like it wont let mme know
thanks for the help


JonnyMac

Specifically, what kind of "audio chip"?  Is this something you're providing power to, or a trigger to?
Jon McPhalen
EFX-TEK Hollywood Office

djm902

it is a cowalacious designs board recorder/ player
and the prop 1 will be providing power and the trigger also

JonnyMac

I'm not sure which Cowlacious audio board that you have so this code is compatible with the CAR/P-200 that I have and should work with his other boards.  Connect your normally-open trigger (button) between P6.W and P6.R.  Connect V+ to the + input on the Cowlacious board, GND to the - input on the Cowlacious board, and OUT0 to the trigger input pin of the Cowlacious 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... 21 OCT 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Solenoid        = PIN1                  ' OUT1/V+
SYMBOL  CapAudio        = PIN0                  ' white->OUT0, black->GND


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

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


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

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00000011                              ' set outputs

  PAUSE 1000                                    ' let CAP initialize


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

  CapAudio = IsOn                               ' start audio
  PAUSE 250                                     ' hold for CAP debounce
  CapAudio = IsOff

  Solenoid = IsOn
  PAUSE 5000
  Solenoid = IsOff

  GOTO Main


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


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


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

djm902

ok now do i cut and past the entire thing or just the program code?

JonnyMac

Just highlight the code with your mouse, press Ctrl+C (copy), then past (Ctrl+V) into your editor.  Be sure to save the file with a appropriate name.
Jon McPhalen
EFX-TEK Hollywood Office

djm902

great thanks for all you help i really appreciate it