http://mbed.org/users/WarwickRacing/code/Debounced/#8992c13bbb9b