Shop OBEX P1 Docs P2 Docs Learn Events
Need Help! — Parallax Forums

Need Help!

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.

Comments

  • PublisonPublison Posts: 12,366
    edited 2020-10-12 00:21
    Welcome to the forums!

    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.
  • There's a label in the code called 'upagian' but the goto statement specifies 'upagain'. I'm thinking the label has a spelling mistake, or the goto depending on your point of view.
  • JonnyMacJonnyMac Posts: 9,155
    edited 2020-10-12 16:32
    We have an Exhibit that runs this script....
    No, you don't. That code is so filled with syntax errors that it doesn't run now and probably never did.

    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.
  • This looks like someone used the BS2 BUTTON code example, and tried to tinker their way to something that works, but failed. What is the purpose of firing the strobe?, light show?, machine project?, etc.
  • So I want to thank you guys for all the help. This is a cleaned up version, we've look at it and tried to put in the right places. This is what we came up with still looks like we are only using one pin is that right? We have two buttons one to freeze (3600fpm) and one for down (3400). The normal state of the is up (3800fpm). Once again we were handed this as what we needed, so thanks for being patient with our lack of knowledge.
Sign In or Register to comment.