From cf8c212a4da9fa31114cb67d7257e26b021bf75b Mon Sep 17 00:00:00 2001 From: viridian Date: Tue, 6 Feb 2024 17:28:33 +0100 Subject: [PATCH] Add usage docs --- Usage.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Usage.md diff --git a/Usage.md b/Usage.md new file mode 100644 index 0000000..c228457 --- /dev/null +++ b/Usage.md @@ -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 + +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); +} + +```