Know its easy (programing)
is it possable to add a varable string to a stamp program such as
a=1
a+1=b
if b = 500 then high 13
b = new a
or something along that line
thanks in advance
Mike
a=1
a+1=b
if b = 500 then high 13
b = new a
or something along that line
thanks in advance
Mike
Comments
thanks for responding!
what I am tring to do is count for a time base (say 3 min.) and the only way I know how to do it is to use "gosub" and make a variable that and a count to it then releases the processor to look at a switch for closer, if I let it count and the switch closes during the time it counts, the stamp never sees it, ( I havent programed anything sence collage 1982 LOL) just working my way thrue it
' {$STAMP BS2}
' {$PBASIC 2.5}
HIGH 14
DO
DEBUG ? IN0
DEBUG ? IN1
IF (IN1 = 1) THEN
LOW 14
HIGH 15
HIGH 12
GOSUB timer_timer
ELSEIF (IN0 = 1) THEN
LOW 15
HIGH 14
ENDIF
LOOP
flash_lights:
LOW 11
HIGH 12
PAUSE 250
LOW 12
HIGH 11
PAUSE 250
RETURN
timer_timer:
a=1
a+1=b
IF b = 200 THEN
HIGH 13
PAUSE 200
b=a
RETURN
Thanks again
Mike
timer_timer:
a=1
a+1=b
IF b = 200 THEN
HIGH 13
PAUSE 200
b=a
RETURN
needs a few tweaks. It might be rewritten several ways, including defining a and b as word or byte variables, or simply using the default variables b0-b15:
timer_timer:
b0=1 'was a=1
b1=b0+1 ' was a+1=b
IF b1 = 200 THEN HIGH 13 'was b=200
PAUSE 200
b1=b0 'was b=a
RETURN
Thank you for your replies
Here is what I am trying to accomplish
Initial power on= high 14 (red indicator "stop")
Start =high 15 (green indication)
Timer activation = high 13, pause 50, low 13 (yellow indication)
timer=upon IN1 activation time is started (approx. 3 min.) at end of time HIGH 12, pause 250, LOW 12, HIGH 15 and timer restart
Start sw = IN1
stop sw = IN0 (if activated HIGH 14, LOW 15, LOW 13, LOW 12) this sw needs to be monitored once or twice a second (this activation is highest priority)
This is for my dust collector
after 3 min if running I want to turn off the blower motor, activate air solenoid, (to shake the dust into the bag) and then automatically start the blower motor again, over and over
The stop (IN0) has to have the highest priority to turn it off
Thank You for your input
Mike
time3Minutes:
time = 720 ' initialize time to 3 minutes at 1/4 second per "tick"
basicTimeLoop:
pause 250 ' 1/4 second "tick"
time = time - 1 ' decrement time-to-go
if in0 = 1 then goto stopTiming ' check for stop button (active high)
if time > 0 then goto basicTimeLoop ' keep going if time not over
' program comes here at end of 3 minutes
Remember that after a test for either IN0 or IN1 pushbuttons being pressed, that you need a loop to check whether they're released like
DO : LOOP WHILE IN0 = 1