Shop OBEX P1 Docs P2 Docs Learn Events
UselessBox - Page 2 — Parallax Forums

UselessBox

2

Comments

  • GenetixGenetix Posts: 1,740
    edited 2018-01-13 22:25
    You don't have to anodize Aluminum parts but it makes them look nicer and last longer.

    Aluminum will react with Oxygen in the air and form a protective oxide on its surface so anodizing just makes this natural layer very thick.
    As part of the process a colored dye can be added to give this layer a nice color.
  • I'm going to post the good as well as the bad during this project, I'm positive the weakest link in this entire project is my ability or lack of to Program, but we learn by doing and by our mistakes....

    I finally over the weekend reinstalled the arm and servo (I had to change location due to design change) and now I was ready to start programing. I was able to get angry bird and the new arm to hit their marks exactly, I was very excited. The new arm ended up working perfectly, I still cant believe I couldn't come up with that myself, but we all learn. I will post a video if I can figure out how or in the very least more pic's.

    Now for the bad news.......

    I spent several hours with no luck trying to get EMIC2 and the RGB to work, if I had any hair I would have pulled it out. I do want to say I did test ALL devices independently of each other (outside the box) so if something is not working I either released the smoke in the device or I"m just not coding properly.

    The only reason I'm not posting any code for you guys to dissect is because at this point in the game with all the components installed in the box and wired I'm now making sure each device is working, so I've been writing separate code for each device and when something wasn't working I was just scrapping the whole thing and starting over.
  • Genetix:

    I'm assuming the Aluminum is already anodized because this was a Ping sensor stand, but I'm covering it with cloth so it will look like Angry Birds hand, or foot, or hoof.
  • Here it is pushing the switch.....
    1296 x 972 - 864K
  • Very Cool!
    Your bird looks good and angry >:(
  • Mikeologist:

    Thanks, he does look pretty Angry. I will be happy to get him out of this cardboard box and into a real, or I should say a Nicer box, but other then that I'm pretty happy with my progress.
  • That is a useful looking useless box!
  • ASKMEASKME Posts: 172
    edited 2018-01-17 20:35
    PBasic ?

    I would use the PULSOUT Command to control an RGB?

    Connection to RGB:
    5v
    Ground
    I/O Pin

    I could not find any example code anywhere, well not exactly true, I did find SPIN code.
  • ASKME wrote: »
    ... I will be happy to get him out of this cardboard box and into a real, or I should say a Nicer box...

    "Nicer" than the Versace box eh?

    Angry Bird's headed for some sort of treat !
    Peep Peep !!

    Well done Paul. Very tidy result. F.A.B.


  • Work in progress, more to come.



  • ASKMEASKME Posts: 172
    edited 2018-01-21 20:35
    I finally accomplished getting both servo's to hit their marks. I disposed of the RGB's because I wasn't aware that they couldn't be run on a basic stamp.
    My next task will be to get the EMIC2 to make some sort of noise, but hopefully I will get a voice out of this thing.
    Since I had to dispose of the RGB's I decided to use a few LEDs in their place, not as exciting but it will do the job.
    Once I get these above task completed I will start to piece the code together. Thank you for all the comments and all the help this would not have been possible without those things.
  • Are you getting a debugging response when trying to use the emic2?
    something like: Unknown Target module. $Stamp Directive not found
  • ASKMEASKME Posts: 172
    edited 2018-01-22 15:31
    mikeologist: I did not use the debugging feature, I guess when I get home from work this evening I will use that feature. I meant to bring the code I wrote and post this morning but I forgot to, sometimes I think dementia is setting in.

    The EMIC2 worked before connecting it to my cricut and the green light is coming on so I have to believe it's something I'm doing. I have it connected to a speaker and when I wasn't getting any noise I changed over and used an external speaker connected to the A/V jack but still no success.

    I'm going to use known good code off of Parallax's Site to in the very least confirm that the EMIC2 is still working and I have connected everything correctly. If this works then I will have to revisit my code and see where I made my mistakes.

    If this wasn't so much fun It might drive me crazy........

    By the way Thanks again for the Help Sir......

  • mikeologist:
    Below is the exact code I used to drive the EMIC2:

    emic_tx PIN 8
    emic_rx PIN 9

    T9600 CON 84
    emicbaud CON T9600

    main:

    SEROUT emic_rx, emicbaud, [CR]
    SEROUT emic_tx, emicbaud, ["N1", CR]
    PAUSE 250

    SEROUT emic_tx, emicbaud, ["S", "I am angry, I am a bird. Do not touch my switch.", CR]

    END
  • You should put your code in blocks.
    [code"] code between [/"code] remove both " marks, they are there so you can see the tag
    emic_tx PIN 8
    emic_rx PIN 9
    
    T9600 CON 84
    emicbaud CON T9600
    
    main:
    
    SEROUT emic_rx, emicbaud, [CR]
    SEROUT emic_tx, emicbaud, ["N1", CR]
    PAUSE 250
    
    SEROUT emic_tx, emicbaud, ["S", "I am angry, I am a bird. Do not touch my switch.", CR]
    
    END
    
    See how nice it looks

    There are some fundamental differences between your code and the sample code here

    Your constraints may be off
    You need to initialize the EMIC2 unit to use it
    I would suggest adding some debug features

    Keep going, you are doing very well.
  • Not sure what you mean about putting my code into blocks?
    My constraints may be off?

    You might have to talk to me like I am two, some terminology I'm not familiar with when it comes to programming, sorry for my ignorance.

    I did get the EMIC2 working when I got home from work, so thank you very much for your help.
  • ASKME,

    The EMIC has a number of settings that you can play with and you could also use a RANDOM variable to have it say a number of different thing instead of just repeating the same thing all the time.
    https://www.parallax.com/sites/default/files/downloads/30016-Emic-2-Text-To-Speech-Documentation-v1.2.pdf
  • Genetix:

    Thanks for the advice, I just finally got it working last night after adding a debug feature to my program which was something mikeologist suggested . I was super stoked so I (saved) my program and went to bed with dreams of sugar plumbs and, Just kidding I kept playing around with the different functions and today I will read up on what other cool functions this small device has in store for me. The only draw back is that I do not have enough time in a day to do ALL the cool stuff I can dream up.

    Once again I can't say this enough, Thank you for ALL the advice, help, and direction. If not for all of the help this project would have been much harder then it needs to be.
  • Update on my progress or lack of progress. I've included four files of code, disregard the one that is called UselessBox it's no longer valid.
    The rest of the code I wrote to confirm that my servo's, EMIC2, LED's, and the vibration device were working properly once wired and installed in my box. I found it easier to write code separately, I'm not sure if that's the way other programmers do it, or I may be the only one.

  • I was going to use the BRANCH command and create a a bunch of different Task and use the RANDOM command to randomly pick one of the Task under the BRANCH command.

    Can I use the example below making idx the controller of my Task?

    The BRANCH command address say's Address0, Address1...AddressN. Please explain Address0...AddressN?

    When using the RANDOM command it says the seed is usually a word, can it be a number?
    I will only have a half a dozen to a dozen Task in my BRANCH command and I want RANDOM to randomly choose between Task_0 to Task_11, how can I accomplish this?





    BRANCH.bs2
    ' This program shows how the value of idx controls the destination of the
    ' BRANCH instruction.
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    idx VAR Nib
    Main:
    DEBUG "idx: ", DEC1 idx, " "
    BRANCH idx, [Task_0, Task_1, Task_2] ' branch to task
    DEBUG "BRANCH target error...", CR, CR ' ... unless out of range
    Next_Task:
    idx = idx + 1 // 4 ' force idx to be 0..3
    1
    All
    2
    NOTE: This example program can be
    used with all BS2 models by changing
    the $STAMP directive accordingly.
    5: BASIC Stamp Command Reference – BRANCH
    BASIC Stamp Syntax and Reference Manual 2.2

    www.parallax.com

    Page 135
    PAUSE 250
    GOTO Main
    Task_0:
    DEBUG "BRANCHed to Task_0", CR
    GOTO Next_Task
    Task_1:
    DEBUG "BRANCHed to Task_1", CR
    GOTO Next_Task
    Task_2:
    DEBUG "BRANCHed to Task_2", CR
    GOTO Next_Task
  • kwinnkwinn Posts: 8,697
    ASKME wrote: »
    Update on my progress or lack of progress. I've included four files of code, disregard the one that is called UselessBox it's no longer valid.
    The rest of the code I wrote to confirm that my servo's, EMIC2, LED's, and the vibration device were working properly once wired and installed in my box. I found it easier to write code separately, I'm not sure if that's the way other programmers do it, or I may be the only one.

    Divide and conquer is the way to go. Getting the individual functions working first makes it easier to put them together and get the whole program working.
  • Whatever your random number you can use modular division by 12 to get a value 0-11.
  • I think this might work, lol....
  • or......
  • Nice formatting :-)
    When will you be able to test it?
  • ASKMEASKME Posts: 172
    edited 2018-01-30 21:03
    Mikeologist:
    Are you pulling my leg, or are you being serious?
    Formatting has been a big hurdle for me and I'm still not sure I'm doing it correctly.

    I still have to write each Task which should be fairly quick since I already have the majority of it partially written. I have nor written any code for the Ping yet so I will have to incorporate that also. Funny thing is I gave myself a deadline to be completed by this past weekend (ended up with grandson over the weekend) and here it is Monday and I'm still not there.

    Tonight I'm shooting for the stars....
  • Not pulling your leg at all, The code you just posted shows a vast improvement :-)
    Happy Testing
  • ASKME,

    This is the Gold Standard for BS2 code, especially the section on the Elements of PBASIC style (page 19).
    https://www.parallax.com/sites/default/files/downloads/27297-StampWorks-Manual-v2.1.pdf
  • Thanks Gentix, I've have this one but I think it's the nesting that I do not completely understand.
  • Updating code...
Sign In or Register to comment.