Need Help!
Heath
Posts: 2
in BASIC Stamp
I was handed off a project from work and need help! We have an Exhibit that runs this script and i'm not sure it's correct. It fires a strobescope.
'{$STAMP BS2}
'{$PBASIC 2.5}
up CON 6311
pulse sp CON 7180
stop
pulse dn CON 7675
stop
pulse pse CON 1
buttondn VAR Bit
buttonsp VAR bit
High 0
upagian:
'DEBUG "up again" , CR
PAUSE pse
PULSOUT 0,up
BUTTON 1,1,255,0,buttondn,1,dnagain
pressed,goes to down loop: "dnagian"
BUTTON 2,1,255,0,buttonsp,1,spagain
pressed,goes to stop loop: "spagain"
GOTO upagain
dnagain:
'DEBUG "Down Again" , CR
PAUSE pse
pulse width
PULSOUT 0,dn
BUTTON 1,1,255,0,buttondn,1,dnagain
pressed GOTO to dnagain, If not Goto next line
Goto upagain
spagain:
PAUSE pse
pulse width PULSOUT 0,sp
BUTTON 2,1,255,0,buttondn,1,spagain
pressed THEN GOTO spagain, IF not GOTO upagain
GOTO upagain
Any Help is appreciate it.
'{$STAMP BS2}
'{$PBASIC 2.5}
up CON 6311
pulse sp CON 7180
stop
pulse dn CON 7675
stop
pulse pse CON 1
buttondn VAR Bit
buttonsp VAR bit
High 0
upagian:
'DEBUG "up again" , CR
PAUSE pse
PULSOUT 0,up
BUTTON 1,1,255,0,buttondn,1,dnagain
pressed,goes to down loop: "dnagian"
BUTTON 2,1,255,0,buttonsp,1,spagain
pressed,goes to stop loop: "spagain"
GOTO upagain
dnagain:
'DEBUG "Down Again" , CR
PAUSE pse
pulse width
PULSOUT 0,dn
BUTTON 1,1,255,0,buttondn,1,dnagain
pressed GOTO to dnagain, If not Goto next line
Goto upagain
spagain:
PAUSE pse
pulse width PULSOUT 0,sp
BUTTON 2,1,255,0,buttondn,1,spagain
pressed THEN GOTO spagain, IF not GOTO upagain
GOTO upagain
Any Help is appreciate it.
Comments
Could you explain with some details? What does it do or not do?
The "STOP" command will stop the program immediately and the rest of the program will not run.
Instead of beating that dead horse, why don't you define your inputs, outputs, and what you need the program to do? Be very specific -- no details left out. There are many of us here with years (a few of us decades) of experience that can help you get it right and set you on a path to writing clean code for the BASIC Stamp.
Whether I'm writing code for a BASIC Stamp or a Propeller, I always start with a template. I've attached my BS2 template to help you get started (you can set this as the template for the Stamp editor which makes things easy). If you define your requirements (in English, not busted code) as I requested above, I'll write you a program that uses this template so that you can see my idea of professionally-crafted BASIC Stamp code.