Skip to content

Commit 28bda08

Browse files
committed
adjust readme
1 parent 2e26bea commit 28bda08

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Servo(id, callback, threshold);
7171
| callback | void (byte, int) | Function to trigger when a servo is moved |
7272
| threshold | byte | Max allowed position diff (default=0 / no threshold handling) |
7373
74+
> Note: the threshold is also used to define the speed for moving a servo to its neutral position when stopping an animation.
75+
7476
### Callback Function
7577
7678
The callback function is used to specify what should happen when a servo needs to be moved to a new position. It will be automatically triggered by the animation instance and receives 2 arguments - the servo ID as `byte` and the new position as `int`:
@@ -183,12 +185,7 @@ myBlenderAnimation.live(stream);
183185

184186
> Note: the default mode can not be triggered as it is only handled internally.
185187
186-
When calling the `stop` method, it is possible to pass a delay in milliseconds. This delay will be used when the servos are moved to their neutral position during the stop mode. To get to the neutral position, the current position will either be increased or decreased by 1. The delay therefore controls how fast or smooth this movement will take place. The default value for this parameter is `20`.
187-
188-
```ino
189-
myBlenderAnimation.stop(); // Default reset speed applied
190-
myBlenderAnimation.stop(30); // Servos will reset slower
191-
```
188+
When calling the `stop` method, the threshold values of the animation's servos are considered to control how fast or smooth they are moving towards their neutral position. Keep in mind that the servos will not have a threshold value by default which results in the stop mode to immediately trigger the neutral position of the servos. A slower and safer movement can be achieved by setting the threshold values as low as possible with the actual animation still able to run properly.
192189

193190
To use the `live` method, we have to pass a stream instance which will be used for reading serial commands. For example, we can pass `Serial` if we want to use the standard USB connection of an Arduino compatible board:
194191

@@ -199,6 +196,8 @@ void setup() {
199196
}
200197
```
201198

199+
This library also comes with a `LiveStream` class which allows for a more generic way to listen to live commands. For example, it can be used as part of the web socket based live mode for which you can find a dedicated example [here](examples/WebSocketLiveMode).
200+
202201
To get the current animation mode, we can simply call the `getMode` method. This will return a `byte` representing one of the mode constants mentioned in the table above. We can then compare the return value to those constants to act according to the current mode:
203202

204203
```ino

0 commit comments

Comments
 (0)