UselessBox

ASKMEASKME Posts: 137
edited December 2017 in BASIC Stamp Vote Up0Vote Down
I'm attempting to build a useless box. It will have two standard servos, several LEDs, one vibrating device, and an Emic board for vocals.
I've seen a lot of these on the internet and I'm trying to make mine very unique.

Most importantly I'm using BS2 BOE/USB BOARD.

Those who have helped me in the past will know that I have been attempting to learn SPIN, but I have been driving myself crazy with that so I decided to play around with PBasic for a while so I can have some fun at least..

My only concern is that I'm going to write a couple of dozen routines, but I want to be able to randomly choose one of the routines whenever the switch is pushed, is it possible to do this with Basic, if so could you tell me what command I need to use or series of commands. I will not have any problem writing the routines.

I have all the parts for this project and I will be posting pictures and also my code as I'm proceeding for any newbies out there like me that are learning to code this will be a great project to follow along on.

Thank you in advance for any help.
«1

Comments

  • 47 Comments sorted by Date Added Votes
  • Look at the BRANCH command in the help file and the manual. This lets you have a bunch of different CASE statements.

    When you press the button, run RANDOM to get a value - which you then check in the BRANCH statement to pick a CASE (randomly!)
    San Mateo, CA
  • Jeff Haas:

    Thank you very much that solves my biggest hurdle I think. I did read up on RANDOM but I wasn't sure how I was going to be able to implement it into my program to get the output I was looking for so it looks like this will solve that problem. Always a curve when learning something new.
  • iI was attempting to upload a picture of my project KIMG0001.jpg and received an error message (The uploaded file was too big (max 2M)). It's just a picture. I see people put files much larger then just a single picture, what am I doing wrong???
  • Maybe others resize their pictures.

    Could you try that?

    There's a few free apps or online services to "resize images" if you search those words.

    Does that help solve?
  • I think I did this right. Thank you VonSzarvas.
    544 x 408 - 56K
  • My prototype will be in this pink VERSACE box. Mounting all components then off and running with creating code.
  • What does the Ping do because maybe you can use another sensor instead such as a PIR?
  • Well Gentix I was going to use the Ping to randomly sense a person and will preemptively turn the switch off even though it was never put in the on position and some other functions also. I guess I could use a PIR in place of my Ping, the thing is I have a Ping, but I do not have a PIR.

    Whats the benefit of one over the other?
  • Looks great. Like the scary pop-out angry bird!
  • The PIR is 1/3 the cost of a Ping and is designed to detect whether something is there or not while the Ping I designed to measure the distance to an object.

    If your box is dark you could use a Photo-resistor or Photo-transistor to detect light.
    You could also use an IR LED and IR detector to sense when the lid is removed.
    Or you could use the Erco old school method and have a micro-switch be closed when the lid is on.

    I just thought you might want to save the Ping for a Robot or something more suited for it.

    Also, since those boxes tend to be flimsy you can reinforce the sides by lining them with cardboard or card stock.
  • The cardboard box is only for the prototype and once I get everything working properly I will move it to a more permanent home, I was leaning towards a wooden box.

    The ending product is for my 6 year old grandson hence the Angry Bird, which happens to be straight out of his toybox.

    I'm going to take advantage of the Ping sensor's ability to track distance into my program, if I didn't already have a Ping sensor I would have used a PIR sensor, but thanks for the education and the advice I'm never too proud to accept both.

    Once I get everything mounted I will upload more pictures and if all goes well with the prototype I upload videos on YouTube of the completed prototype working and I will upload on this forum the code I write for this project.

    Thank you in advance for any and all help...

  • The box I'm using is pretty strong for being made out of cardboard, but if you look closely I have a piece of plywood cut and mounted along the side to support the servo's and I will be placing one along the opposite wall to do the same.
  • One other wise word of advice is to test each component individually to see that it works before writing your main program.

    Once you know all the hardware is working then any problem will be with the software.
    Oh and I like to use CONstants in my programs especially for I/O pins or other values that might change. Makes modifying or tweaking the program a breeze.

    Does it have any blinking lights?
    Kids love that! :P
  • Genetix:

    I am using blinking lights, I have several RGB's that I will be using in one way or another. Since ultimately this project is for my grandson the use of lights was a given. I'm also using an Emic2 in my project and a https://www.parallax.com/product/28822 .

    I absolutely planed on testing each component independently to verify that everything is working properly before I start to code. When I do start coding I planned on writing a couple dozen case statements and using the BRANCH command.

    When I press the button, I will run RANDOM to get a value - which I will then check in the BRANCH statement to pick a CASE (randomly!)

    This project has turned out to be a lot of fun and I do appreciate all the help and advice. I will keep posting updated picture as things progress.
  • I'm not familiar with BRANCH, but you can use SELECT...CASE or IF...THEN...ELSE

    The Emic is a nice touch.

    Take a look at the StampWorks manual because I know you will need tweak the RANDOM value to get it in the range of your cases.

    The Propeller is especially suited for something like this because it's a lot faster and you can offload repetitive tasks to each of the Cogs.
  • Genetix:

    Funny that you mention Propeller because I was thinking how better suited it was to the task at hand but the only drawback is my inability to program in SPIN otherwise I would be using the Propeller.
  • I added the Emic2 because in all the examples I saw on YouTube that was one feature I never saw utilized. In the end I'm hoping to make mine very unique with several dozens of different features and combinations of features that have not been used or under used.
  • Making progress on my UseLess BoX. I have everything mounted (Be it crudely at times) and wired (All one color, I know this is not the best idea) as of Monday night.
    I still need to manufacture some way to hold my arm and guide it to the switch, like a tuning fork type of device. Not completely sure how I'm going to accomplish this.

    Happy New Year to All !!!!!

    I will Post more as I progress through this project.
    1296 x 972 - 1M
    1296 x 972 - 817K
  • I knew my biggest hurdle was going to be the engineering of an arm to turn the switch off once it was turned on and I was absolutely right.

    Admittedly I should have done just a little investigation, like go to YouTube and (which I ended up doing) see if anyone out there opened one of these up to see how it works.

    Now I will disassemble the arm portion of my box and rework it.

    If not for my failures my successes would not seem so Great...
  • This was my poor attempt.....
    1296 x 972 - 213K
  • To eliminate the linkage you could use a lobe lifter like the cam shaft in an engine, instead.
    Basically a triangle with rounded corners. With the lobes at 120 degrees you would only need to rotate your servo by 60 degrees to lift and then another 60 degrees to lower it.
    Happy to draw you a picture if needed.
    Any com port in a storm.
    Floating point numbers will be our downfall; count on it.
    Imagine a world without hypothetical situations.
  • the-useless-box-turns-itself-off-4226.jpg
    http://odditymall.com/includes/content/upload/the-useless-box-turns-itself-off-4226.jpg
    A lot of boxes don't use linkages for the finger either.
    Any com port in a storm.
    Floating point numbers will be our downfall; count on it.
    Imagine a world without hypothetical situations.
  • mikeologist:
    Thank you for the advice but I do not have access to a CnC machine, linkage, lobe lifter, cam shaft, these are I dare say not in my wheelhouse.
    I'm limited not so much by budget as I am by lack of knowledge in this area. In the end I have to have a solid executable idea for my final box, right now I have a little flexibility because it's a prototype.

    The example I saw on YouTube was different then this one you posted. The one I saw the arm was just a square with the top cut off, it looked pretty straightforward and it's something I will be able to reproduce I'm hoping.
  • Here is my idea (in cardboard form) for my arm to turn off the switch, in this position the switch will be turned off then the servo will drop the arm out of view.
    I will either make this of plastic or metal. Hopefully I can put this issue to bed once and for all...
    1296 x 972 - 1M
  • ASKME wrote: »
    Here is my idea (in cardboard form) for my arm to turn off the switch, in this position the switch will be turned off then the servo will drop the arm out of view.
    I will either make this of plastic or metal. Hopefully I can put this issue to bed once and for all...

    That looks really good. Can't wait to see it in action.
    Any com port in a storm.
    Floating point numbers will be our downfall; count on it.
    Imagine a world without hypothetical situations.
  • ASKME,

    Don't forget Erco's favorite material, plywood. I would suggest Birch aircraft-grade plywood since it looks nicer than standard plywood.
    I've seen it at both Home Depot and Michaels.
  • Gentix:
    Now that's funny.... but, all joking aside plywood just might be the perfect material because of these ease of being able to make different shape fairly easily with standard hand tools. The thing is that in the end I will be covering it with some sort of fabric (It needs to look like angry Birds arm and hand, foot?) or similar material so thanks for the advice (I guess I owe Erco a thumbs up also) now I know how I'm going to proceed.

    I will take a trip to Home Depot or similar this weekend and have this project back together and ready to code.

    I'm excited once again.
  • Cut it to size and sanded all sharp edges. looks like this may work for my arm instead. It's aluminum and with a couple of mounting holes I might be in business.

    By the way any guesses as to what this is???? Okay I will spill the beans, it's an aluminum Ping Sensor stand chopped up.
    972 x 1296 - 1M
  • ASKME,

    Not too shabby.
    Are you going to anodize those Aluminum parts?
  • I hope not. So I need to?
    By the way I just finished and this works perfectly.....
Sign In or Register to comment.