Skip to content

Commit 62bd4fd

Browse files
authored
Merge pull request #32 from arduino-libraries/marqdevx/reference-test
TESTING: reference API
2 parents 058d4e6 + c9fa909 commit 62bd4fd

File tree

1 file changed

+166
-0
lines changed

1 file changed

+166
-0
lines changed

docs/api.md

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# MKR IoT Carrier library - TEST in-progress
2+
3+
## Class1
4+
### `method1()`
5+
#### Syntax
6+
7+
```
8+
servo.attach(pin)
9+
servo.attach(pin, min, max)
10+
```
11+
12+
#### Parameters
13+
14+
* _servo_: a variable of type `Servo`
15+
16+
#### Example
17+
```
18+
#include <Servo.h>
19+
```
20+
21+
#### See also
22+
23+
* [test1()](#test1)
24+
* [test2()](#test2)
25+
26+
## Class2
27+
28+
## Class3
29+
30+
## Buttons
31+
32+
### `getTouch()`
33+
34+
Attach the Servo variable to a pin. Note that in Arduino 0016 and earlier, the Servo library supports servos on only two pins: 9 and 10.
35+
36+
#### Syntax
37+
38+
```
39+
servo.attach(pin)
40+
servo.attach(pin, min, max)
41+
```
42+
43+
#### Parameters
44+
45+
* _servo_: a variable of type `Servo`
46+
* _pin_: the number of the pin that the servo is attached to
47+
* _min_ (optional): the pulse width, in microseconds, corresponding to the minimum (0 degree) angle on the servo (defaults to 544)
48+
* _max_ (optional): the pulse width, in microseconds, corresponding to the maximum (180 degree) angle on the servo (defaults to 2400)
49+
50+
#### Example
51+
52+
```
53+
#include <Servo.h>
54+
55+
Servo myservo;
56+
57+
void setup()
58+
{
59+
myservo.attach(9);
60+
}
61+
62+
void loop() {}
63+
```
64+
65+
#### See also
66+
67+
* [test1()](#test1)
68+
* [test2()](#test2)
69+
70+
### `Y()`
71+
72+
Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with 0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement).
73+
74+
#### Syntax
75+
76+
```
77+
servo.write(angle)
78+
```
79+
80+
#### Parameters
81+
82+
* _servo_: a variable of type Servo
83+
* _angle_: the value to write to the servo, from 0 to 180
84+
85+
#### Example
86+
87+
````
88+
#include <Servo.h>
89+
90+
Servo myservo;
91+
92+
void setup()
93+
{
94+
myservo.attach(9);
95+
myservo.write(90); // set servo to mid-point
96+
}
97+
98+
void loop() {}
99+
````
100+
#### See also
101+
102+
* [test1()](#test1)
103+
* [test2()](#test2)
104+
105+
### `test1()`
106+
107+
Writes a value in microseconds (us) to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft. On standard servos a parameter value of 1000 is fully counter-clockwise, 2000 is fully clockwise, and 1500 is in the middle.
108+
109+
Note that some manufactures do not follow this standard very closely so that servos often respond to values between 700 and 2300. Feel free to increase these endpoints until the servo no longer continues to increase its range. Note however that attempting to drive a servo past its endpoints (often indicated by a growling sound) is a high-current state, and should be avoided.
110+
111+
Continuous-rotation servos will respond to the writeMicrosecond function in an analogous manner to the write function.
112+
113+
#### Syntax
114+
115+
````
116+
servo.writeMicroseconds(us)
117+
````
118+
119+
#### Parameters
120+
121+
* _servo_: a variable of type Servo
122+
* _us_: the value of the parameter in microseconds (int)
123+
124+
#### Example
125+
126+
````
127+
#include <Servo.h>
128+
129+
Servo myservo;
130+
131+
void setup()
132+
{
133+
myservo.attach(9);
134+
myservo.writeMicroseconds(1500); // set servo to mid-point
135+
}
136+
137+
void loop() {}
138+
````
139+
140+
#### See also
141+
142+
* [test2()](#test2)
143+
144+
145+
### `test2()`
146+
147+
Read the current angle of the servo (the value passed to the last call to [write()](#write)).
148+
149+
#### Syntax
150+
151+
````
152+
servo.read()
153+
````
154+
155+
#### Parameters
156+
157+
* _servo_: a variable of type `Servo`
158+
159+
#### Returns
160+
161+
The angle of the servo, from 0 to 180 degrees.
162+
163+
#### See also
164+
165+
* [test2()](#test2)
166+

0 commit comments

Comments
 (0)