Shop OBEX P1 Docs P2 Docs Learn Events
need help with my project — Parallax Forums

need help with my project

AthurkiddAthurkidd Posts: 3
edited 2008-11-21 21:57 in BASIC Stamp
Hi everybody, as you can see this is the first time I post in this forum and its a shame that my first post is a help request :S. Well this is what happened my dad buy this new parallax basic stamp and he asked me to help him in his project. He wants to make a ozone machine that can vacuum the air from a container and then fill it with ozone, the machine need have the option to program the time and vacuum and filling, and also that that routine can repeat and you can program the many time it will repeat, also see the programmed times and the time that it accumulate from the routine. So I finally manage to comply with this requisite and finish the machine but this happened for some reason that still confuse me the machine doesn’t stop vacuum when it get to the programmed time, so I tried everything to fix this, the only thing that I see that really have effect is change the variable of the programmed time to a number and it seems to stop, but the objective is that the machine stop in a programmed time and not in a number that you need to change from the basic stamp program. So what do you think can you help me?

Comments

  • SRLMSRLM Posts: 5,045
    edited 2008-11-20 02:10
    Okay, so the problem is:

    The vacuum timer is a variable in code, and you want to make it modifiable from outside the code. Correct?

    You have several options to fix this. You can add a section where the user enters a number (two buttons [noparse][[/noparse]increment and decrement] and an LCD would work) that is an approximate time count: just use that value that the user enters into some sort of loop.

    You can also use a timer chip for exact times, but that will complicate your project some. =Can you point out the specific line to look at? (PS: you can post files at .BS2 so that they open in the editor by default)

    Welcome to the forums!
  • AthurkiddAthurkidd Posts: 3
    edited 2008-11-21 17:43
    SRLM said...
    Okay, so the problem is:

    The vacuum timer is a variable in code, and you want to make it modifiable from outside the code. Correct?

    You have several options to fix this. You can add a section where the user enters a number (two buttons [noparse][[/noparse]increment and decrement] and an LCD would work) that is an approximate time count: just use that value that the user enters into some sort of loop.

    You can also use a timer chip for exact times, but that will complicate your project some. =Can you point out the specific line to look at? (PS: you can post files at .BS2 so that they open in the editor by default)

    Welcome to the forums!

    Well actually I theres already a section to modificate the vacuum time, its in the .txt that I attached in this post and I also put a timer on it. But the problem is that the machine doesnt stop in the progammed time and it seems that it also doesnt acummulate the time sad.gif. I checked the progam but I cant find the problem, this really put me really confuse. So do you have any idea that can the problem be?
  • SRLMSRLM Posts: 5,045
    edited 2008-11-21 18:51
    Your code is really straining my Spanish abilities... [noparse]:)[/noparse]

    Anyway, take a look at line ~250 (or so) There are two for loops, yet all that happens is that they set the increment variables equal to the end variables: aka, they don't really do anything.

    I'm afraid I can't help much more with the way the code is at the moment. It will help if you format it a little better. Use these general rules to format code (by convention)


    1. Avoid the use of GOTOs, and instead replace with GOSUBs
    2. Place all code into a method (aka Start: or Begin_Vac[noparse]:)[/noparse] to help organize
    3. Have comments that tell what each method does (or make it self documenting)
    4. For multilingual code, some comments in English (translations of names) would be helpful.


    Often times, just by making the code easier to read you will be able to fix problems without even noticing it...
  • AthurkiddAthurkidd Posts: 3
    edited 2008-11-21 20:48
    Lol I forgot to traduce some parts and I apologize for my disorder. Actually I’m new on this and it is really hard for me to organize the codes. Ill try to organize it and ill put some comments in English in the parts were I need help. Ill post later my progress.
  • SRLMSRLM Posts: 5,045
    edited 2008-11-21 21:57
    The easiest way to learn proper formatting is to look at a professional's code, like the code that Parallax posts on their product pages. Take a look at some (it doesn't really matter which) and see what sort of organizational techniques they use, then try to imitate them.

    Post Edited By Moderator (Chris Savage (Parallax)) : 11/24/2008 6:06:23 AM GMT
Sign In or Register to comment.