Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ssloy/penny.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Sokolov <ssloy@users.noreply.github.com>2020-02-19 16:40:40 +0300
committerGitHub <noreply@github.com>2020-02-19 16:40:40 +0300
commit042759a40d69575f003cfdf678b9cc9c6d592a8a (patch)
treed61dc899d1eac00fb8b6d3c8b1484445f317cfe0
parent3da6a2c211e1d94611f2519ecc893c9e34d79e00 (diff)
Update README.md
-rw-r--r--README.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/README.md b/README.md
index c8d7cc8..9eeaa86 100644
--- a/README.md
+++ b/README.md
@@ -111,6 +111,14 @@ OCR1B = 1500; // right servo
OCR2 = 1500/16; // center servo
```
## Movement planner
+
+![](https://raw.githubusercontent.com/ssloy/penny/master/doc/servos-pos-range.jpg)
+
+```c
+const uint8_t zero[3] = {45, 50, 40}; // zero position of the servo (degrees)
+const uint8_t range[3] = {25, 25, 20}; // the servos are allowed to move in the zero[i] +- range[i] interval
+```
+
Current servo position (in degrees, 0°-90°) is supposed to be stored in the `uint8_t pos[3]` array. When calling `update_servo_timers()`, the timers are updated according to the array.
All the movements are planned as constant speed. To give an example, let us suppose that we want to move the left servo only. All we need to do is: