http://mbed.org/users/okini3939/code/PS_PAD/#840370e1dcce