Open Call: send us your Debounce code

If you’ve ever designed an embedded system with at least one button you’ve had to deal with button debouncing. This is also know as contact bounce, a phenomenon where a button press can be registered as multiple button presses if not handled correctly. One way to take care of this is with a hardware filter built from a resistor-capacitor setup, or by using a couple of NAND gates. We find that [Jack Ganssle] put together the most comprehensive and approachable look at contact bounce which you should read through if you want to learn more.

We’re interested in software solutions for debouncing buttons. This seems to be one of the most common forum questions but it can be hard to find answers in the form of reliable code examples. Do you have debounce code that you depend on in every application? Are you willing to share it with the world? We’d like to gather as many examples as possible and publish them in one-post-to-rule-them-all.

Send your debounce code to: debounce@hackaday.com

Here’s some guidelines to follow:

  • Please only include debounce code. Get rid of other unrelated functions/etc.
  • You should send C code. If you want to also send an assembly code version that’s fine, but it must be supplementary to the C code.
  • Please comment your code. This will help others understand and use it. You may be tempted to explain the code in your email but this info is best placed in the code comments
  • Cite your sources. If you adapted this code from someone else’s please include a note about that in the code comments.

As an example we’ve included one of our favorite sets of debounce code after the break. Please note how it follows the guidelines listed above.

[Read more...]

As promised: more industrial robot goodness

Remember [Mattythorne]? He took a BMW industrial arm and re-purposed it to write twitter messages on a white board. You can read a small excerpt here.

Well [Matt] is back, and as promised includes an entire write up for how he got @scribblebot scribbling twitter messages.  It’s a little light on details and we wish there was some more in-depth how-to magic, but then we remembered with most of the population not having an industrial arm in the first place the extra time spent incorporating the extra info would be far from worth it. Regardless, it doesn’t surprise that the previous commentators were not far off the mark in how difficult programing one of these machines would be. While such arms do have a few built in libraries it looks like a very exhausting process to override the default axis of motion, incorporate a UI, build a pen holder, and more. And in the end, is it worth it? [Matt] tells us the arm is going to be going back to monotonous car building work soon, giving weeks of prep only a day in the limelight.

Automated entry for a garden gate

[Dan McGrath] tipped us off about a solution for a problem that most people don’t have. He built a web-based entry system for his garden gate. This isn’t quite as original as that chain and sprocket dorm room system, but it does use a keypad for entry. [Dan's] already got a web server and home automation box that is always running. He coded a webpage that presents a virtual keypad for code entry. If the right code is input the system unlocks the electronic strike on the other side of this gate. Since the interface is a web page you can load if from any web browser (an iPhone is used for demonstration purposes after the break). But if you don’t have internet access you’re in trouble; there’s no physical keypad. But we guess you could always just jump the fence.  [Read more...]

Android Development 101- Part 4:Advanced Database/GUI Code and DDMS

In this tutorial we are going to cover some advanced database code as well as tie in to some more advanced GUI techniques. We left off on the last tutorial showing you how to insert and select data to/from the database as well as make a table. What we need now is to be able to delete data if it is not needed and update it if we entered it incorrectly. We will tie these abilities in with some more advanced functionality utilizing a long press on the screen for delete and for updating we will just press the data we want to edit.

[Read more...]

Android Development 101 – Part 3:Introduction to Databases

In this tutorial we will be pivoting from our last tutorial on Graphical Elements to start focusing on databases in Android development. The android platform uses SQLite databases in its applications and is one of five data storage options in android development. We will only be focusing on SQLite development in android because it is key to the construction of a workable/functional program. After this tutorial you should be able to implement a SQLite database that you are then able to insert and select items from tables in the database.

For this project we will be creating a Random Quote generator that has you enter quotes or sayings in a textbox and press a button to insert them into the database. We will issue a confirmation toast that allows us to see if the data was entered into the database successfully and the textbox will be blank. If a second button is pressed, the database will be accessed and told to select a random quote from the database to show in a toast on the screen.

[Read more...]

Coded safety for diy laser

Finally we see a hack that is focuses on safety when it comes to high-power laser hacks. A safety switch has been added to the butt of the flashlight body which houses the laser diode. When the safety is flipped on an LED blinks to prompt the user for a security code. If you enter the correct code on a momentary push switch, electrical access to the laser is enabled. There are also a couple of nice features such as continuous on and auto shutoff.

This would be hard to implement if you’re working on a watertight package but we like the fact that an unsuspecting house guest won’t go blind if searching for a flashlight during a storm. One last thing, the code entry system is PIC based which reminds us of [Alan Parekh's] one-button system.

May the Phorse be with you

The PhorsePOV by [Julian Skidmore] almost slipped by, but we thought it was a nice easy hack for your Memorial Monday. The gadget uses an ATTINY25 to drive 6 LEDs aren’t standard characters 7 units high? Which when waved in the air produces a readable message. What we were really interested in is the use of a single button for text entry, called Phorse code, or an “easier to learn and remember” version of Morse code. While it seemed silly at first, most of us here could enter messages within a few minutes of trying.

Follow

Get every new post delivered to your Inbox.

Join 91,443 other followers