Bing Zhang / Mbed 2 deprecated TouchSense

Dependencies:   mbed

touch0.cpp

Committer:
bzhang10
Date:
2010-11-30
Revision:
0:cdbd21489e81

File content as of revision 0:cdbd21489e81:

#include "mbed.h"

#define numsamples 1

AnalogIn input(p20);
DigitalIn charger(p19);
DigitalOut ground(p18);

int touchSense0(void) {
    float sample;
    ground = 0;
    charger.mode(PullUp);
    charger.mode(PullNone);
    sample=input.read();
    if (sample < 0.3) {
        return 1;
    } else {
        return 0;
    }
}