Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: How to make a simple button for Dummy's??HELP

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Location
    Philadelphia Pa
    Posts
    3

    How to make a simple button for Dummy's??HELP

    Good Day,
    This is my first post and I'm looking for some much needed help. I want to make a button for a DIY photo booth, the button needs to emulate a space bar strike. But all the coding and soldering talk is Greek to me. I have a Teensy and I'm running windows after that I'm lost. If someone would be so kind and point me in the right direction.
    Thanks

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,393
    Teensy really is about DIY electronics, so you're going to have to learn a few things to get this done. If you don't have the time or interest to learn some new tech skills, I'd highly recommend you simply buy one that is already made. It does cost more than only buying the raw materials, but if your time is valuable (and learning electronics skills wouldn't be a good time investment), it's really not terribly expensive considering the time you'll spend. Here's the link:

    http://store.2xlnetworks.com/thebutton/

    To build it yourself, the first you must learn to walk before you can run. Well, at least blink an LED before you can push a button!

    First, you'll need to download the Arduino software and the Teensyduino installer. Unzip Arduino (and make a mental note of when it is on your computer), then run the Teensyduino installer to add the Teensy stuff.

    http://www.pjrc.com/teensy/td_download.html

    Then you'll run Arduino. Select Teensy from the Tools > Boards menu. The open the LED blink from File > Examples > 01.Basics > Blink. If using a Teensy 2.0, edit the pin number to 11 (read the comments in the code). Every Teensy comes with pre-loaded with a program that blinks the LED. Your goal is to program the LED blink to blink at different speeds. This page has a detailed tutorial.

    http://www.pjrc.com/teensy/tutorial.html

    If you run into problems, solutions to all the most common issues are on this troubleshooting page:

    http://www.pjrc.com/teensy/troubleshoot.html

    You can also ask for help here. But generally you'll get much better answers if you post details of what you've already done, specific info about what's going wrong (even screenshots or photos), and what you've already tried and what did or didn't happen.


    So, once you have mastered the LED and you can make it blink at your whim, you're ready to do the button. Again, start with an example. Open it using File > Examples > Teensy > USB_Keyboard > Buttons.

    This example requires you to set Teensy to act as a Keyboard. Use the Tools > USB Type menu to select "Keyboard + Mouse + Joystick". Then program it with that example.

    Before you bother with using an actual button, you can use just a piece of wire or a paperclip. The button just connects its 2 wires together when you press it, so you can "press" a missing button by just touching 2 pins together with a paperclip.

    Always touch the paperclip to the GND pin first. If you've built up a static charge, it's safe to "shock" the GND pin. Then touch the other side to a nearby pin (but never touch GND and +5V or VCC together). If Teensy is running the buttons example, you should see things like "B0_press" and "B0_release" being typed into your computer as you touch between GND and pin 0 (which is the one right next to GND, near the USB connector).

    One you have that working, the next step is to modify the code to type only a space instead of B0_press. And of course when you have it working exactly the way you want with a paperclip, then you'll need to physically connect a pushbutton, and fabricate an enclosure for the whole thing somehow.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Location
    Philadelphia Pa
    Posts
    3
    Thanks so much, this should get me started. Coding and electronics has been something I've wanted to learn for some time. This button looked liked a great starter project. And buying something that I can do myself is never feasible. Especially if I've never tried it. Thanks again, I'll post my results shortly.

  4. #4
    Junior Member
    Join Date
    Mar 2013
    Location
    Philadelphia Pa
    Posts
    3
    Thanks a lot every one got it done with out a hitch, well just some soldering issues but I got it together. Can't wait to start something else.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,393
    Great, glad you got it working. If you have any photos of the final build in actual use, would love to see them?

  6. #6
    Junior Member
    Join Date
    Jul 2013
    Posts
    2
    Hello Paul:

    Thank you for nearly the instant e-mail reply today. I went through each step listed above and made major progress. Thank you!

    I got an LED to blink, and tried different things for it to type in, and all worked.

    Here is the only thing I am caught up on... I want the button to type a space only, and it is typing a space followed by a return (enter) key. Any possible way to get this to only type the space without the return?

    Also, how would I get it to act like an arrow key? What would I type in the Keyboard.println("TYPE HERE"); field to get it to make a right or left arrow?

    Thanks again for your help.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,393
    Quote Originally Posted by zoneent View Post
    I want the button to type a space only, and it is typing a space followed by a return (enter) key. Any possible way to get this to only type the space without the return?
    Change Keyboard.println() to only Keyboard.print().

  8. #8
    Junior Member
    Join Date
    Jul 2013
    Posts
    2
    Quote Originally Posted by PaulStoffregen View Post
    Change Keyboard.println() to only Keyboard.print().
    Thank you greatly Paul, that worked perfectly. Did you get a chance to notice my second question about the arrow keys? Please let me know when you get a chance and thanks again!

  9. #9
    Junior Member
    Join Date
    Dec 2015
    Posts
    3
    Quote Originally Posted by zoneent View Post
    Thank you greatly Paul, that worked perfectly. Did you get a chance to notice my second question about the arrow keys? Please let me know when you get a chance and thanks again!
    Did you happen to figure out a code to make the left and right arrows work? Thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •