Add usage docs
parent
d2aefa5999
commit
cf8c212a4d
50
Usage.md
Normal file
50
Usage.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
# Usage
|
||||
|
||||
## Function for Function
|
||||
|
||||
### `Servo my_servo(int,int)`
|
||||
|
||||
This creates a new instance of a servo the two int are the pins.
|
||||
|
||||
|
||||
### `begin()`
|
||||
|
||||
Sets both pins as out and sets them low.
|
||||
|
||||
### `position(int)`
|
||||
|
||||
Sets the position to one of three values they mean:
|
||||
|
||||
0=Neutral position
|
||||
|
||||
1=The first non Neutral position
|
||||
|
||||
2=The second non Neutral position
|
||||
|
||||
## Example
|
||||
|
||||
```
|
||||
#include <lego_servo.h>
|
||||
|
||||
Servo my_servo(2,3);
|
||||
// Creates a new servo called my_servo on pin 2 and 3
|
||||
void setup() {
|
||||
my_servo.begin();
|
||||
// Sets the pins to an OUTPUT and LOW
|
||||
}
|
||||
|
||||
void loop()
|
||||
my_servo.position(1);
|
||||
// Go to position one
|
||||
delay(1000);
|
||||
|
||||
my_servo.position(2);
|
||||
// Go to position two
|
||||
delay(1000);
|
||||
|
||||
my_servo.position(0);
|
||||
// Go to neutral position
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
```
|
Loading…
Reference in a new issue