Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
test_capsense_main.h
- Committer:
- fionalin
- Date:
- 2022-08-04
- Revision:
- 2:d9745be6c253
File content as of revision 2:d9745be6c253:
#include "mbed.h" #include "capsense.h" #include <cstdio> const PinName CS_MEASURE = D2; const PinName CS_SQUARE = D3; // main() runs in its own thread in the OS int main() { CapSense cap_sense(CS_MEASURE, CS_SQUARE); while (true) { cap_sense.start(); // turn it on while (!cap_sense.try_measure()) {} printf("%d\n", cap_sense.read_measurement()); // we read a value, so safe to turn off cap_sense.reset(); wait_us(70000); // wait a bit to discharge } }