0
\$\begingroup\$

As a preface: I have 0 experience in interfacing with peripherals other than keyboard and mouse, but am willing to learn, just don't know where to start.

I would like to write a software in python (if C/C++ would be needed or is the easier way to go I can interface that) running on a PC, that can be manipulated by two external buttons (it will be an experimentel setup for small children, so we need big easily identifiable buttons, that are easy to push, so the keyboard/mouse is out of the question). The easiest would be to buy two USB buttons, that can be easily accessed, but I've been told these do not exist, and that I would have to build an interface myself (microcontrollers and stuff). If this is not true that would be great, if it is, I would like to invest my time into something that is not horribly hard and long to learn to use, and both the knowledge and equipment easily reusable if other issues like this come up. What would you recommend?

Thanks in advance:)

\$\endgroup\$

closed as off-topic by Bence Kaulics, Voltage Spike, Daniel Grillo, Autistic, David Nov 4 '16 at 6:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ Can be done with python. \$\endgroup\$ – JRE Oct 17 '16 at 18:14
  • 1
    \$\begingroup\$ Look up a device called a makey makey. it might suit your needs without requiring much learning of hardware. if memory serves, its about $20, and gives you access to 5 buttons (it also lets you do odd stuff like make a banana a button). \$\endgroup\$ – ambitiose_sed_ineptum Oct 17 '16 at 18:36
2
\$\begingroup\$

People who told you they don't exist sorta lied.

What you will need:

  • The cheapest mouse you can find. Really, the cheapest.
  • Your Big Easy To Use Whatever You Need buttons. Grab an SPDT type.
  • Some fancy tripolar cable to connect them, grab the size and color you like
  • A soldering iron, and somebody able to use it

First of all, crack open your mouse. You will see something like this:

An old mouse By Job at English Wikipedia - Transferred from en.wikipedia to Commons by Ansumang using CommonsHelper., GFDL, Link

See those tiny little guys on the right, with red little thingies on top? These are microswitches, something like this:

microswitch By Benjamin D. Esham / Wikimedia Commons, CC BY-SA 3.0 us, Link without the metal thing on top. The red thingies correspond to the black piece of plastic on the top left of the switch case.

You now need to identify the terminals of the switch. Odds are that they are labeled as C or COM, NO and NC, as COMmon, Normally Opened, Normally Closed.

Now you need to start soldering. Your Buttons will have three similarly labeled terminals: you need to remove the switches and solder your cables where the switches used to be, then solder the cables to the terminals on your buttons. Really, it's easier said than done.

Finally, enjoy making your rig nice and all so that a young human fancies using it and is not endangered by anything.

And... Bingo. You're done.

Now, this is not really useful to you, in the sense that you do not learn much. But this solution has many pros: it is dirty cheap, easy for you to interface to, no worries about safety for the youngsters, great flexibility, you name it.

\$\endgroup\$
  • \$\begingroup\$ I might go the arduino way - to learn something new - but I'm accepting your answer, for giving a thorough guide :) \$\endgroup\$ – fbence Oct 18 '16 at 11:30
1
\$\begingroup\$

Have you looked into Arduino? You can look into many tutorials, write the code in C++ and have the kids press the buttons. The buttons can be used to light up LEDs, or move a servo motor, etc.

https://www.arduino.cc/

\$\endgroup\$
1
\$\begingroup\$

This can be done multiple different ways. You could simply hook an Arduino board with a few wires and resistors to the push buttons so you can read back which button was pushed and when it was pushed, and so on. This interface would use C/C++. In terms of programming, this is not hard at all but I do not really know what you are trying to do with the pushbuttons so I cannot help you there.

In short, the keyboard of your computer is reading which pushbutton has been pressed by simply assigning each pushbuttons an ASCII character or an address that would tell you which character has been pressed. The mouse performs the same way. The program will deal with what has been pressed.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.