November 23, 2024, 04:20:56 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.


Connecting additional PIR Sensors on Controller

Started by eboomer, October 14, 2009, 08:46:58 AM

Previous topic - Next topic

eboomer

Maybe it's me but I cannot find where to put additional PIR sensors on the controller.  I am only assuming it would go right under where I connected the first one.  Am I right on this assumption?  I don't want to fry it.  Help :'(

JonnyMac

You can use any of the IO pins on the Prop-1/2/SX -- you just have to write the code to handle the additional sensor(s).
Jon McPhalen
EFX-TEK Hollywood Office

vista

I was wondering if you could give us a code snipet of what that code would look like... I like to d/L these and add them to my collection... You'll notice I haven't asked anything so far this year well in that past few months at least... (Only  because I'm trying to do really simple things)   ;D 

And yes it can wait until all the emergencies and Halloween have passed, very low priority....

Vista

JonnyMac

There are many ways to skin a cat -- and cook 'em up, too! (very tasty!)  ;D  Yes, I'm kidding.  I love cats -- I could eat them every day!  

Okay, I've got to run back to my friend's haunt -- have a look at this program; it uses triggers on P5 and P6 to do different processes; the trigger on P5 is checked first so it gets priority.

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated... 24 OCT 2009
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Sio     :: Serial IO to EFX-TEK accessories (RC-4, FC-4, etc.)
'            -- clip pin 1 of ULN2803 or replace with ULN2003
'
' Trigger :: Parallax-compatible PIR or N.O. button (mat switch, etc.)
'            -- connect N.O. button between P6.W and P6.R


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger2        = PIN6                  ' SETUP = DN
SYMBOL  Trigger1        = PIN5                  ' ULN acts as pull-down


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' B/R jumper removed


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

SYMBOL  triggers        = B0
SYMBOL   T2             =  BIT6                 ' corresponds to P6
SYMBOL   T1             =  BIT5                 ' corresponds to P5

SYMBOL  idx             = B2
SYMBOL  lottery         = W5


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

Reset:
 PINS = %00000000                              ' clear all
 DIRS = %00011111                              ' set output pins


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

Main:
 triggers = %01100000                          ' arm T1 and T2 for scan
 FOR idx = 1 TO 20                             ' 100ms scan (20 x 5ms)
   RANDOM lottery
   PAUSE 5
   triggers = triggers & PINS                  ' scan inputs
 NEXT
 IF triggers = %00000000 THEN Main

Check_T1:                                       ' randomize P0 - P4
 IF T1 = IsOff THEN Check_T2
   PINS = %00000000                            ' clear old
   idx = lottery // 5                          ' random, 0 - 4
   HIGH idx                                    ' turn pin on
   PAUSE 100
   GOTO Main

Check_T2:
 IF T2 = IsOff THEN Main
   PINS = %00000000                            ' clear pins
   FOR idx = 0 TO 4                            ' sequence through 0 - 4
     HIGH idx
     PAUSE 100
     LOW idx
   NEXT
   GOTO Main


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


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


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


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

eboomer

I passed the information to a friend for the two sensors on the prop 1 controller and we are now trying to put a program  that when someone sets off the sensors, air from above shoots down at the unsuspecting.  I can't seem to write one that uses two of the sensors to be separate but do the same thing.  I would like for it to shoot air at them for about 2 seconds or so to start.  I know it's close to Halloween, time crunch and all but is there someone that can help me write one?  Any help would definitely be appreciated.  so much to do with so little time!

JonnyMac

Please start a new thread with your specific program request -- include all the details (more than you think we need) about how the prop is supposed to behave.

This topic was on how to connect to sensors; that has been answered and this thread is locked (due to the attempted change of topic).  Following our forum guidelines and suggestions will eliminate delays in getting answers to your questions.
Jon McPhalen
EFX-TEK Hollywood Office