Shop OBEX P1 Docs P2 Docs Learn Events
Question on Experiment 3 challenge 3 in WAM v. 1.5 — Parallax Forums

Question on Experiment 3 challenge 3 in WAM v. 1.5

Chris DrzewieckiChris Drzewiecki Posts: 26
edited 2006-01-02 16:15 in Learn with BlocklyProp
I have version 1.5 of WAM and was going through the experiments.· I'm attaching a copy of my code for Challenge 3 of Experiment 3.· It's to make a servo go to one extreme, midpoint, back to same extreme the the other extreme.· Did I go about this the right way?· I'm only using the coding that was demonstrated up to exp. 3.

Thanks!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Chris

Post Edited (Chris Drzewiecki) : 1/2/2006 6:07:20 AM GMT

Comments

  • Chris DrzewieckiChris Drzewiecki Posts: 26
    edited 2006-01-02 13:40
    Basically I'm teaching myself and was wondering if my logic and structure is good.· I've taken programming classes many years ago in ASM (SPARC and x86), COBOL,· BASIC, C, C++, and PERL.

    Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Chris
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-02 13:57
    Chris -

    Before any of us answers your question, in an effort to avoid any embarrassment, are you looking for:

    1. Yes, that will work

    OR

    2a. If I were wrinting the same program, I might have taken this approach ... .
    2b. You can improve the speed of your code by implementing it like this ... .
    2c. By doing ... so and so ... you can ... blah, blah, blah

    I think you get the idea here.

    No sense offering a critique, if one isn't really wanted smile.gif

    Regards,

    Bruce Bates
  • Chris DrzewieckiChris Drzewiecki Posts: 26
    edited 2006-01-02 14:06
    I know it works, so I am looking for a critique so 2a, 2b, and 2c. You can't embarass me so shoot away! [noparse]:)[/noparse] hehe

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Chris
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-02 14:42
    Chris -

    I haven't checked this revised version for errors (of mine), but here's what I might have done (attached). Looks pretty good, if you ask me. Most of the changes I made were towards better self-documentation (a quirk of mine), and some comments on performance.

    Regards,

    Bruce Bates
  • Chris DrzewieckiChris Drzewiecki Posts: 26
    edited 2006-01-02 15:10
    Bruce-
    Thanks for the tips and critiques. I was going to improve and correct the doc. after I get the logic and structure worked out. The new features and commands in 2.5 are great and thank you for pointing them out, since this version is based on 1.9. However I wrote this program based on what was covered in Experiments 1 -3 and most of the changes you made are further than what was taught. The code is not made to be efficient but to teach the principles and basics. That's why I think there are 1 second pauses in it to allow the student to easily observe what the servo is doing. So far in 1-3 it covered For-next loops, labels, GOTO, and variables structure wise. I do like how your code is more efficient, variables are better named, and better documented. I would of went beyond and looked up the syntax for other commands that I would normally use, such as constants, but I wanted to keep the program within the scope of what was covered. It's been a while since I programmed and wanted to get back into it and especially to hone my logic and structuring skills. I feel no opinion or criticism should be taken as an offense, but as a learning experience. There are many ways to do things and it's good to get other ideas because sometimes your brain gets stuck in one 'mode' so to speak. With that aside, is my logic and structure solid?

    Thanks again for your help!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Chris
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-02 15:50
    Chris -

    I obviously didn't look at the "lesson", but I see nothing wrong with the way you approached the problem. It's hard for me to say much more than that, when you somewhat limit what can be said by the comment that this was based "on what was covered in Experiments 1 -3", and nothing more is implied.

    Perhaps I'm wrong, but I woudn't think any instructor would comdemn any program for using, or any student for reading, the supplied manual, and using what was found therein (at least I didn't when I taught). The only exception I can think of, is that it's often necessary to learn the "building block" approach of doing something, using a number of instructions or sub-routines, before you advance to using a more sophisticated, all-in-one command, which accomplishes the goal in one shot.

    Whether you use the advanced features of it or not, I would consider using the latest version of the Parallax PBASIC Compiler. I can't think of any reason not to, and many reasons to do so. This is essentially true for any software which you might happen to use. This comes from my many YEARS in tech support smile.gif

    Regards,

    Bruce Bates
  • Chris DrzewieckiChris Drzewiecki Posts: 26
    edited 2006-01-02 16:15
    I believe in the "Building Block" or "Baby Steps" approach. Since it's entirely new for me to program something that interacts with non conventional (non-computer) hardware, other than a keyboard, mouse, and monitor, I thought it would be less frustrating to take this approach. I am using the latest Windows editor/compiler and I am using the 2.5 code header.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Chris
Sign In or Register to comment.