Saturday, May 31, 2014

eRCaGuy_ButtonReader Library for Arduino - Debounce and read the current button state, & most recent action ("just pressed" or "just released") easily!

ADVERTISEMENT:

Subscribe by Email!
By Gabriel Staples
Written: 31 May 2014
Last Updated: 25 July 2015
Article History (newest on top)
-added button image & updated download links - 25 July 2015

Other Articles to Check Out:
This Article:

Library History (newest on top):

20141031: major bug fix; added multi-button support with a new 5-button-reader example!
20140531: first release.
Misc. push buttons which can greatly
benefit from digital debouncing. 
(Image source here).

Summary:

I wanted a simple and universal, yet very powerful & reliable library to read a button or switch in such a way that I can easily implement toggled actions and momentary actions, know the true, debounced state of a button or switch at any given time, and specify whether I want an action to take place when the button is *pressed* or *released.* This library makes implementing all of these things easy for me, and I now use it on all of my projects that require reading a button or switch, so I wanted to share it with others. Hopefully you find it useful too. Check out the included examples.  

This code is an elaboration of, and library form of, the main Arduino-sponsored "Debounce" example found here.  Thanks to David A. Mellis, Limor Fried (LadyAda), and Mike Walters for writing that excellent and well-thought-out example code.

Download:

(Optionally) donate, & download via the link just above, or by clicking here then choosing the appropriate download.  Install the library into the Arduino IDE (using Sketch --> Include Library --> Add .ZIP Library), then run the examples to see how to use the library.


***Subscribe by Email!***

Tuesday, May 13, 2014

Using the Arduino Uno’s built-in 10-bit to 16+-bit ADC (Analog to Digital Converter)

ADVERTISEMENT:

Subscribe by Email!
By Gabriel Staples Written: 13 May 2014
Last Updated: 16 Sept. 2015

History (newest on top):
-16 Sept 2015 - changed title from "10-bit to 21-bit ADC..." to "10-bit to 16+-bit ADC..."
-25 July 2015 - added a brief update below, updated download links
-17 Feb. 2015 - changed latest link to new release: V2.1 alpha, in yellow below
-24 Jan. 2015 - added link to Version 2.0 alpha below...allows sampling rates of ~50+ kHz, and fixed bug to allow >16-bit samples to not have computation errors

A Few Other Articles to Check Out:

This Article:

Using the Arduino Uno’s built-in 10-bit to 16+-bit ADC (Analog to Digital Converter)???
--Wait, what did you say!? I thought that Arduinos only had a 10-bit ADC!  How can you get, for example, 16-bit resolution out of a 10-bit ADC?  Well, the answer is oversampling.  Atmel has written a really good article about it called "AVR121 Enhancing ADC resolution by oversampling."

Before I continue, I'd like to give a special thanks to user "fat16lib," on the Adafruit Forums, who first made this technique known unto me by his post right here, thereby inspiring me to write this, my first ever, library.

Now on to the library:


***Subscribe by Email!***