Skip to content

Commit 621ea0d

Browse files
Update README.md
1 parent bd52bbd commit 621ea0d

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,24 @@ The source files are also heavily commented, so check those out if you want fine
2323
Here's a basic example:
2424

2525
```Arduino
26+
// include the ResponsiveAnalogRead library
2627
#include <ResponsiveAnalogRead.h>
2728
29+
// define the pin you want to use
2830
const int ANALOG_PIN = A0;
31+
32+
// make a ResponsiveAnalogRead object, pass in the pin, and either true or false depending on if you want sleep enabled
33+
// enabling sleep will cause values to take less time to stop changing and potentially stop changing more abruptly,
34+
// where as disabling sleep will cause values to ease into their correct position smoothly
2935
ResponsiveAnalogRead analog(ANALOG_PIN, true);
3036
37+
// the next optional argument is snapMultiplier, which is set to 0.01 by default
38+
// you can pass it a value from 0 to 1 that controls the amount of easing
39+
// increase this to lessen the amount of easing (such as 0.1) and make the responsive values more responsive
40+
// but doing so may cause more noise to seep through if sleep is not enabled
41+
3142
void setup() {
43+
// begin serial so we can see analog read values through the serial monitor
3244
Serial.begin(9600);
3345
}
3446
@@ -50,14 +62,20 @@ void loop() {
5062
}
5163
```
5264

53-
##Methods for usage
65+
##Constructor arguments
66+
67+
- `pin` - int, the pin to read (e.g. A0)
68+
- `sleepEnable` - boolean, sets whether sleep is enabled. Defaults to true. Enabling sleep will cause values to take less time to stop changing and potentially stop changing more abruptly, where as disabling sleep will cause values to ease into their correct position smoothly.
69+
- `snapMultiplier` - float, a value from 0 to 1 that controls the amount of easing. Defaults to 0.01. Increase this to lessen the amount of easing (such as 0.1) and make the responsive values more responsive, but doing so may cause more noise to seep through if sleep is not enabled.
70+
71+
##Basic methods
5472

5573
- `int getValue() // get the responsive value from last update`
5674
- `int getRawValue() // get the raw analogRead() value from last update`
5775
- `bool hasChanged() // returns true if the responsive value has changed during the last update`
5876
- `void update(); // updates the value by performing an analogRead() and calculating a responsive value based off it`
5977

60-
##Settings
78+
##Other methods (settings)
6179

6280
###Sleep
6381

0 commit comments

Comments
 (0)