Skip to content

Commit

Permalink
adding readme
Browse files Browse the repository at this point in the history
  • Loading branch information
inesmaria08 committed Nov 20, 2024
1 parent 96eaad5 commit 37fa0fb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions examples/servo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Servo Controller App
=====================

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.

Example Output
--------------

```
The number of available servomotors is: 1
Requested angle 0. Actual current angle is: 0
Requested angle 1. Actual current angle is: 1
Requested angle 2. Actual current angle is: 2
...
Requested angle 180. Actual current angle is: 180
```

If the servo index is out of range:
```
The index number is bigger than the available servomotors
```

If the servo cannot report its angle:
```
This servo cannot return its angle.
```
4 changes: 2 additions & 2 deletions examples/servo/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ int main(void) {
return -1;
}
returncode_t result = RETURNCODE_EOFF;
uint16_t servo_count = 0;
uint32_t servo_count = 0;
libtock_servo_count(&servo_count);
printf("The number of available servomotors is: %d\n", servo_count);
printf("The number of available servomotors is: %ld\n", servo_count);
uint16_t angle = 0;
uint16_t index = 0; // the first index available.

Expand Down

0 comments on commit 37fa0fb

Please sign in to comment.