Skip to content

Commit 28d789a

Browse files
committed
adding readme
1 parent 28ff21d commit 28d789a

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

examples/servo/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Servo Controller App
2+
=====================
3+
4+
A simple app that tests the functionality of a connected servo motor by reading its initial angle, adjusting the angle from 0 to 180 degrees, and verifying the actual angle at each step.
5+
6+
Example Output
7+
--------------
8+
9+
```
10+
The number of available servomotors is: 1
11+
Requested angle 0. Actual current angle is: 0
12+
Requested angle 1. Actual current angle is: 1
13+
Requested angle 2. Actual current angle is: 2
14+
...
15+
Requested angle 180. Actual current angle is: 180
16+
```
17+
18+
If the servo index is out of range:
19+
```
20+
The index number is bigger than the available servomotors
21+
```
22+
23+
If the servo cannot report its angle:
24+
```
25+
This servo cannot return its angle.
26+
```

examples/servo/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ int main(void) {
1111
return -1;
1212
}
1313
returncode_t result = RETURNCODE_EOFF;
14-
uint16_t servo_count = 0;
14+
uint32_t servo_count = 0;
1515
libtock_servo_count(&servo_count);
16-
printf("The number of available servomotors is: %d\n", servo_count);
16+
printf("The number of available servomotors is: %ld\n", servo_count);
1717
uint16_t angle = 0;
1818
uint16_t index = 0; // the first index available.
1919

0 commit comments

Comments
 (0)