Basic class to interface with a 3-pin capacitive proximity sensor
CAPsensor.cpp
- Committer:
- snapo
- Date:
- 2021-11-01
- Revision:
- 0:a9afa14d4795
File content as of revision 0:a9afa14d4795:
#include "CAPsensor.h" capacitorSensor::capacitorSensor (PinName capSense): capSense_ (capSense) {}; //function measures the reading of the sensor and then prints to console the result. void capacitorSensor::capReading(){ capReadings_ = capSense_.read_u16(); if (capReadings_ > 1000){ printf("Sensor is Pressed/Activated \n"); } else { printf("Sensor is NOT Pressed/Activated \n"); } }