November 23, 2024, 05:57:41 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


prop-1 trainer, trigger ?

Started by insanehobbies, April 24, 2009, 11:17:26 PM

Previous topic - Next topic

insanehobbies

I've just received my first prop-1. Followed the set up from Garage Of Evil on the debug set up. Everything good!! So I used the demo version and hit the trigger button and just one LED came on. In order to have it run the complete program I have to hold the trigger button down. My question, is this normal? And my next question is when I write my own program and run in on the trainer will I have to hold the button down or just hit it and watch it run?

Thanks Keith  :o

EricTheMannn

Try this out, i assume you're using this tutorial GOE http://garageofevil.com/tech/prop1_101_push_button_test.php
The led in the program is connected to pin 1, play with this code a bit, and pauses, ons, offs and so fourth till you get the hang of it.

Search the forum for bits of code,and modify it, the more you play with basic the easier it gets!


-Eric


                                                        '======================================================================
'   File..... SPST Push-Button Switch Test 11.11.07.bs1
'   Author... Geoff @ The GARAGE OF EVIL!!
'   Web...... http://www.garageofevil.com
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' -----[ Program Descripton ]------------------------------------------
' Using a Radio Shack SPST Switch Button (Part #275-011), connected via
' two wires (WR) on the Prop-1 to PIN0, when pressed, it completes the
' circuit, and then prints out "Success!" to the DEBUG window, letting
' you know that the button has been pressed.
'======================================================================

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

SYMBOL IsOn         = 1
SYMBOL IsOff        = 0
SYMBOL Trigger1     = PIN0
SYMBOL LED          = PIN1    'PIN 1 ON YOU'RE PROP-1
' -----[ Program Code ]------------------------------------------------

Main:
  IF Trigger1 = IsOn THEN TestButton
  GOTO Main

TestButton:
  LED = IsOn           'TURN'S LED ON
  PAUSE 1000           'ALLOWS THE LED TO STAY LIT FOR 1 SEC.
  LED = IsOff          'TURN'S LED OFF AND DEBUG "SUCCESS!"
  DEBUG "Success! "
  GOTO Main
WooHoo

JonnyMac

Let me just point out that one should debounce the trigger input -- this is especially important when using PIRs or long wire runs around other electrical devices.  What's debouncing?  Debouncing is a process of ensuring that you have a valid signal.  When we do this:

Main: 
  IF Trigger = IsOff THEN Main


... we can detect a signal on the trigger pin and fall through to the program, but... a noise spike, at just the right time, can look like a trigger and cause a false start.   Debouncing ensures that the signal is valid by measuring the input and validating the signal when some minimum duration is met.

Below is my standard Prop-1 programming template.  There is a debouncing loop at Check_Trigger that prevents the program from starting until the Trigger input sees a signal that is 100ms (0.1s) in duration.  This guarantees no false positives.

Note: You can save this file on your system and load it whenever you select File\New in the editor -- see the Preferences dialog in the BASIC Stamp editor.

' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2009 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$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  Trigger         = PIN6                  ' SETUP = DN


' -----[ 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  timer           = B2


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

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


' -----[ 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

  ' prop code here

  GOTO Main


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


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


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


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


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


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


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

Jon McPhalen
EFX-TEK Hollywood Office

insanehobbies

April 25, 2009, 01:24:43 PM #3 Last Edit: April 25, 2009, 02:40:06 PM by insanehobbies
Thanks for the responses! I forgot to add that its on the trainer that I have to hold the little trigger button down in order to run that program from the Garage of Evil (the LED Bounce program ). I guess I don't understand, my question is if I write a program and test it out on the trainer when I press the little trigger button will the program run, or will I have to hold the button down for it to run?

Thanks Keith

OK!!!!   I've been playing!! I've have my answer! I don't have to hold the button. Now to try to write some stuff. Thanks Again!