diff --git a/README.md b/README.md index 678ef9d..d5614cb 100644 --- a/README.md +++ b/README.md @@ -9,31 +9,34 @@ This library makes use of internal wiring to get decent resolution with just a s some MCUs one extra sacrificial pin, shared between allows the touch sensors). ## Usage -`ADCTouchSensor touchSensor = ADCTouchSensor(int analogPin, int sacrificialPin = -1, unsigned delaytime = [device dependent]);` -`touchSensor.begin(unsigned samples=500);` -`value = touchSensor.read(unsigned samples=5);` -`value = touchSensor.readRaw(unsigned samples=5);` +* `ADCTouchSensor touchSensor = ADCTouchSensor(int analogPin, int sacrificialPin = -1, unsigned delaytime = [device dependent]);` -* analogPin: The pin to read data from +* `touchSensor.begin(unsigned samples=500);` -* sacrificialPin is grounded and used for internal purposes. It shouldn't +* `value = touchSensor.read(unsigned samples=5);` + +* `value = touchSensor.readRaw(unsigned samples=5);` + +* `analogPin`: The pin to read data from + +* `sacrificialPin` is grounded and used for internal purposes. It shouldn't be connected to anything (beware of shorts). A single sacrificialPin can be used for many ADCTouchSensor instances. On the stm32f103c, you can omit the sacrificial pin, and an internal grounded ADC channel can be used. If your STM32F1 MCU has such a channel -- likely, the same one, namely 15 -- you can edit the library to support it (and email me) -* delayTime is the amount of extra time to allow for charging up the touch pin; the default value is +* `delayTime` is the amount of extra time to allow for charging up the touch pin; the default value is device dependent -* samples: number of samples to take +* `samples`: number of samples to take -* begin(): reads a sample reference piece of data +* `begin()`: reads reference data -* read(): reads a value and corrects it via the reference data; the value can in principle range +* `read()`: reads a value and corrects it via the reference data; the value can in principle range from -1024 to 1023, but in practice tends to be in the single digits (plus or minus) if there is no touch and at least 100 if there is a touch. Returns -10000 if the setup is wrong (i.e., no sacrificialPin and wrong MCU). -* rawRead(): reads but does not correct via reference data; value can range from 0 to 1023. - Returns -10000 if the setup is wrong (i.e., no sacrificialPin and wrong MCU). \ No newline at end of file +* `rawRead()`: reads but does not correct via reference data; value can range from 0 to 1023. + Returns -10000 if the setup is wrong (e.g., no sacrificialPin and MCU that requires it).