Shop OBEX P1 Docs P2 Docs Learn Events
BS2SX Storing Input Data? — Parallax Forums

BS2SX Storing Input Data?

beazleybubbeazleybub Posts: 102
edited 2008-05-19 18:53 in BASIC Stamp
I'm not sure·how to exactly ask this but here it goes.

Let's say I have two push buttons "Button A" and "Button B" and I push "Button A" ten times and then walk away from the bs2sx for a snack break for several minutes.

Later I come back and press "Button B" and in return the bs2sx flashes an LED as many times as I had pushed the button "ten flashes".

How hard is this to accomplish?

Thanks!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
What if there was nothing? Nothing is something!

Comments

  • ercoerco Posts: 20,259
    edited 2008-05-19 01:44
    Why that's so simple, it's almost a waste of a BS2-SX! It's like using a·747 to deliver newspapers.

    You can achieve what you ask·with any & all Basic Stamps, down to the simplest BS-1. In fact, it sounds like this is all new to you, and may I humbly suggest that you consider using a BS-1 Project Board. At $15, it's the best deal going. It has a prototyping area to plug into, a 9-volt connector, serial cable connector, and 8 I/O pins, each lovingly protected by·its own·220-ohm resistor. Nothing not to love about that deal. It's ALMOST indestructable and a fantastic place to start. I teach·classes in programming them, I use them in projects at work, I've built contest-winning robots with them. Very useful and flexible.

    But if you already have a BS2-SX and a carrier board, you're on your way. No matter which chip you choose, monitoring & counting button presses and blinking LEDs are the most basic·things to learn and program.·You need two pushbuttons, an LED, and some resistors. Get or download the What's a Microcontroller book, and you'll be programming in no time.

    You could ask someone here exactly how to·do it, but you'll learn more going through the book. The author Andy Lindsay is a wonderful tech writer, and all-around great guy!

    Do the right thing, beazleybub!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • beazleybubbeazleybub Posts: 102
    edited 2008-05-19 04:02
    Well yes I'm new and I have already developed a dual relay board using the bs2sx and already have the "what's a microcontroller" book which I am into religiously. I have a basic stamp homework board, basic stamp 2 OEM board, basic stamp 2sx board and also my own version of the basic stamp 2sx "bare bones" PCB that I designed for my dual relay controller which·features an 8 position dip switch, two PC relays, an LED indicator and a onboard voltage regulator which was a feat for me and I am very proud of. smilewinkgrin.gif

    The problem I face is that between juggling 50+ hours at my night shift job and having a family to take care of I have a devil of a time finding the time to study and retain what I read in my book.

    I am more a hands on kind of guy and it is easier for me to learn by example. I really wish I had more time to study my book. I really find myself getting interrupted constantly because of my family life and never seem to be able to retain what I have practiced! shocked.gif

    If you would be so kind to point out what chapter(s) in my book might help me out with this I would really appreciate it.

    What I actually plan to do is incorporate this new idea into my existing bs2sx relay board as a revision.

    Thanks again, Beazleybub

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    What if there was nothing? Nothing is something!
  • ercoerco Posts: 20,259
    edited 2008-05-19 09:31
    See·WAM page 83-88, Activity #4, "Two pushbuttons controlling two LED circuits". This gives you the exact wiring diagram you need, even an extra LED. If you have a BS2 homework board, you can use the pictorial diagram easily with the breadboard area. I suggest that you·try this before you hardwire your BS2SX board. The HOMEWORK BOARD ONLY has built-in resistors on each pin, so·you can delete four resistors; two 220 and two 470 ohm resistors. That is, use a jumper wire in place of those 4 resistors on the HW board only. Keep the two 10K pulldown resistors in any case.

    Depending on your pushbutton type, you might get some noise or·bounce when you press it, so you'll have to deal with that using the BUTTON command or a simple timing loop that limits how fast you look for keypresses. If you have the Stampworks book, Experiment #15 shows·one way·to debounce multiple switches. You could also add a small capacitor (.1 to 1 uF) across each switch to filter the signal.

    Software-wise, you'll need two loops: one to count the button presses·and one to flash the LED. I'm an old-school fan of·FOR-NEXT loops for these counting loops. But I digress. Hook up your switches & LEDs and work through that WAM example. Let us know how you do!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • beazleybubbeazleybub Posts: 102
    edited 2008-05-19 17:32
    Erco,

    Thanks for your input. Unfortuneately I do not have the stampworks book. Can I download it from Parallax?
    Also Will I be Using Read / Write Commands in this project?

    You have given me some good ground to stand on and I will let you know how things turn out.

    Thank you.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    What if there was nothing? Nothing is something!
  • ercoerco Posts: 20,259
    edited 2008-05-19 18:24
    Not sure if SW is a free download, but you can do without it for now. You won't need READ/WRITE unless you want to retrieve data after power down. Hook up those switches & LEDs per WAM and check back once they're working. Cheers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • LarryLarry Posts: 212
    edited 2008-05-19 18:36
    Stampworks book and source files are available as a free download if you can't wait.


    www.parallax.com/Store/Books/BASICStamp/tabid/168/List/1/ProductID/144/Default.aspx?SortField=ProductName%2CProductName
  • beazleybubbeazleybub Posts: 102
    edited 2008-05-19 18:53
    Thanks a bunch! I will.

    Warmest regards to you and yours.

    And Larry, I love your avatar! tongue.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    What if there was nothing? Nothing is something!
Sign In or Register to comment.