November 17, 2024, 05:20:17 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.


Doghouse prop how to?

Started by sk287930, February 13, 2008, 03:18:51 PM

Previous topic - Next topic

sk287930

Here's what I want to do. I just want to start
with such a simple prop. A dog in a dog house that pops out. Only
one cylinder meaning only one solenoid and sound.  I want the dog
to come out (cylinder extend) while at the same time
the audio of dog barking loud goes off.  I want the dog to come out and barking for 7 seconds and then return inside the dog house and sound goes off.
If at all possible could I please get the code to put in the stamp.  Thanks for your help.
-Scott

JonnyMac

This one is pretty easy -- here's the program (give me a couple days and I'll create a hook-up diagram).

' =========================================================================
'
'   File...... Dog_House.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 13 FEB 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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

' Connections:
' -- dog valve = V+ and OUT0
' -- trigger input = P6 (SETUP jumper should be DN)
' -- connection to AP-8 = P7


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Dog             = PIN0


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

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

SYMBOL  IsOut           = 1                     ' dog extended
SYMBOL  IsHiding        = 0                     ' dog retracted


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

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs

  SEROUT Sio, OT2400, ("!AP8", %00, "X")        ' stop audio (if playing)

  timer = 0                                     ' reset timer


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

Main:
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 200 THEN Main                      ' wait for 0.2 sec input

Start_Bark:
  SEROUT Sio, OT2400, ("!AP8", %00, "P", 0)     ' play segment 0

  Dog = IsOut                                   ' extend dog
  PAUSE 7000                                    ' wait 7 seconds
  Dog = IsHiding                                ' hide dog

  GOTO Reset                                    ' reset everything


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


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


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

JonnyMac

Here's a diagram to help you with the connections.

Jon McPhalen
EFX-TEK Hollywood Office

Caretaker.CCI

The new "hook-up" diagrams are nice. Wish I'd had those when I started. Thanks for taking the time to create these. A picture is worth...

Greg

JonnyMac

I'm learning CorelDRAW so that I can do these things.  Glad you think it helps -- I just have to find a better and faster way to do thet 3-conductor extenders.
Jon McPhalen
EFX-TEK Hollywood Office

sk287930

Awesome!!  Thanks so much for the diagram Jon as it will help me soooo much.  This is the kind of stuff that makes me first of all, real excited to be jumping in to using micro-controllers and second of all, doing repeat business with efx-tek. 

Just one more question about the diagram is what type of cords/wires are the red, white and black that are connecting the AP-8 to the prop 1?  Will any of this be included in the prop 1 starter kit?  Thanks once again for your help Jon and anyone else on the board.  All of my questions really probably do sound elementary but I can't even begin to express how thankful I am for all of your help. 

Caretaker.CCI

The 3-wire servo connectors can be 24awg or 22awg (or some other variation) and are not necessarily red, white, and black (although that makes connections easier). Other color schemes exist (ie. black,red,yellow). There is nothing significant about the color other than to make sure that the "white" connector on the Prop-1 is connected to the connector labeled "white" on the AP-8 (or other) board. Here is a link to one of many suppliers:

http://www.servocity.com/html/48__servo_extensions.html

Your kit will probably come with one but the connectors are like clamps (in woodworking)... you can never have too many. Buy some more (in varying lengths) and then buy just the wire and connectors and learn how to make them. Somewhere in these forums was a bit about how to make them... they are not hard.

Don't worry about the elementary questions... we all started at the bottom, and yes... it is fun! Once you have control over several different kinds of devices, you are limited only by  your imagination (I think I've heard that somewhere!?).

Greg

JonnyMac

February 23, 2008, 07:51:08 AM #7 Last Edit: February 23, 2008, 07:55:25 AM by JonnyMac
The three-wire connectors come with all accessories, so you'll get one with your AP-8 and one with the PIR.  If you need extras, you can get them here:

-- http://www.efx-tek.com/topics/cables.html (bottom of page)

In the middle of March we'll have a longer version; it's nearly six feet long (175 cm).  It will cost $6 (qty 1).
Jon McPhalen
EFX-TEK Hollywood Office

Caretaker.CCI

And of course you can get them at EFX-TEK. Sorry Jon, I wasn't thinking about you guys... I was just trying to post an example of a servo cable that was not the standard red, black and white, hence the link that I posted.

Glad to hear you're going to have longer versions in stock! Those will come in handy especially since you guys are so fast getting things shippend out.

Greg

sk287930

I now have all of this hooked up according to the diagram and can not get it to work.  Am I suppose to have the ap-8 on lo or hi?  and also is it the red box in the lower left w/ 1,2 ,3 and 4 suppose to all be open or closed according to the code above.  And the actual prop-1, is it suppose to be switched to 1 or 2?  It's just that the PIR sensor isn't making the prop work.  All that I am able to do is manually press the play button on the ap-8 and the sound goes on.  That's all that I can get.  Any help is appreciated.  Also, it might be because the code isn't correctly on the prop-1.  Exactly how do I instert the code onto the prop-1?  By just pressing run?  Thanks once again.

-scott

JonnyMac

You got a lot of problems listed.  Why don't you start by posting a digital image of your setup so we can see how things are connected.
Jon McPhalen
EFX-TEK Hollywood Office

sk287930

I just need to know if clicking "run" is putting the code into the prop 1 for now and I'll take a pic tommorrow.  I appreciate your help.
-Scott

JonnyMac

Yes, if you have the Prop-1 powered and the BS1 Serial adapter correctly connected, you can download the program.  You should see a progress bar on the screen as the program is being downloaded.
Jon McPhalen
EFX-TEK Hollywood Office