delayer of sorts
VbGuru
Posts: 35
I am working on coding a time delayer of sorts. I need it to watch a pin and wait for it to change. I then need it to mimic how long the pin is high and apply it to the output pin. I have the code made for my two pots that adjust the delay from when the input goes high till the output get toggled and the delay after the input is toggled till it will be able to be toggled again. I am getting a double hit on some passes with the IR sensor and I want to filter it so I dont get two back to back. Also while I am at it I coded a delay in the output so I could move the sensor to a better location and still have everything trigger at the correct times. I am using the Basic stamp 2. Any ideas
.
Thanks !
Mat
Thanks !
Mat
Comments
http://www.instructables.com/id/Piecax-the-Poltergeist-A-Troublesome-Spirit-in-a/
Kind of a PJ Allen thing goin' on wit dat Addam's Family theme.
And this one: http://www.instructables.com/id/Knock-Block/
and this one is a combination lock of sorts: http://www.youtube.com/watch?v=g4ttdTbqlyA
Somebody better make one before I do!
not sure how to do the cool window for the code but here is mine.
//code
' {$STAMP BS2}
' {$PBASIC 2.5}
' in a nut shell i need a filter between an ir sensor and the unit so i can control
' the delay after the sensor senses the item till the kicker kicks so that i can
' eliminate the current problem of the ir sensor double kicking within a second or so
' of the first kick. the shortest time between tiggers should be around 3 seconds
' I have two pots setup on pins 12 & 13 as an easy way to vary the delays before and after.
' the before delay is so that i cn move the sensor to a better spot to sense at and it will
'still allow the part to travel down the belt to the kicker before it kicks.
'variables
time1 VAR Word
time2 VAR Word
'the goods
Main:
DO
HIGH 13 'For RC time on both pots pin 12,13
PAUSE 2
RCTIME 13, 1, time1
HIGH 12
PAUSE 2
RCTIME 12, 1, time2
DEBUG HOME, " time1 = ", DEC time1, " time2 = ", DEC time2," " ,? IN10, CR
IF (IN10 = 1) THEN 'if a signal is sensed on pin 10 then
PAUSE time1 'pause for variable time1 this is for
HIGH 15 'adding a pre-kick delay so the ir sensor
PAUSE 15 'can be put in an optimal spot before the
LOW 15 'kicker
ELSE 'pin 15 is the output pin that is getting
LOW 15 'filtered. timer2 is a delay so that it will
ENDIF 'not immediatly try and kick again (which is
PAUSE time2 'the current ir sensors problem)
LOOP
code \\
Also thanks for all the information and responses. (Im still looking into the pulsin idea, something new to learn about)
--Rich