Skip to content

Commit 7892aeb

Browse files
committed
Update with getting start ready
- move all un ready files into bak folder
1 parent ed4327a commit 7892aeb

File tree

813 files changed

+31849
-18743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

813 files changed

+31849
-18743
lines changed
Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
**AmebaServo Class**
2+
3+
**Description**
4+
5+
A class used for controlling servo motors connected to Ameba boards.
6+
7+
**Syntax**
8+
9+
class AmebaServo
10+
11+
**Members**
12+
13+
+-----------------------+---+----------------------------------------------+
14+
| **Public | | |
15+
| Constructors** | | |
16+
+=======================+===+==============================================+
17+
| A | C | |
18+
| mebaServo::AmebaServo | o | |
19+
| | n | |
20+
| | s | |
21+
| | t | |
22+
| | r | |
23+
| | u | |
24+
| | c | |
25+
| | t | |
26+
| | s | |
27+
| | a | |
28+
| | n | |
29+
| | A | |
30+
| | m | |
31+
| | e | |
32+
| | b | |
33+
| | a | |
34+
| | S | |
35+
| | e | |
36+
| | r | |
37+
| | v | |
38+
| | o | |
39+
| | o | |
40+
| | b | |
41+
| | j | |
42+
| | e | |
43+
| | c | |
44+
| | t | |
45+
| | . | |
46+
+-----------------------+---+----------------------------------------------+
47+
48+
**Public Methods**
49+
50+
+----------------------------+-----------------------------------------+
51+
| AmebaServo::attach | Attach a PWM pin to control servo. |
52+
+============================+=========================================+
53+
| AmebaServo::detach | Detach the servo. |
54+
+----------------------------+-----------------------------------------+
55+
| AmebaServo::write | Write a value to control servo. The |
56+
| | value is between 0 -180 degrees. |
57+
+----------------------------+-----------------------------------------+
58+
| Ame | Write a value to control servo. The |
59+
| baServo::writeMicroseconds | value is between 544 - 2400us. |
60+
+----------------------------+-----------------------------------------+
61+
| AmebaServo::read | Read the value from servo and returns |
62+
| | current pulse width as an angle between |
63+
| | 0 and 180 degrees. |
64+
+----------------------------+-----------------------------------------+
65+
| Am | Read the value from servo and returns |
66+
| ebaServo::readMicroseconds | current pulse width in microseconds. |
67+
+----------------------------+-----------------------------------------+
68+
| AmebaServo::attached | Check if the servo is attached. |
69+
+----------------------------+-----------------------------------------+
70+
71+
**AmebaServo::attach**
72+
======================
73+
74+
**Description**
75+
76+
Attach a PWM pin to control servo on Ameba boards. Minimum and maximum
77+
pulse width can be set optionally.
78+
79+
**Syntax**
80+
81+
uint8_t attach(int pin);
82+
83+
uint8_t attach(int pin, int min, int max);
84+
85+
**Parameters**
86+
87+
pin: A PWM pin that is one of the Ameba boards' PWM pins.
88+
89+
min: Minimum pulse width to be set for PWM. By default, the min is
90+
544us.
91+
92+
max: Maximum pulse width to be set for PWM. By default, the max is
93+
2400us.
94+
95+
**Returns**
96+
97+
0
98+
99+
**Example Code**
100+
101+
Example: ServoSweep
102+
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/Analog/examples/ServoSweep/ServoSweep.ino)
103+
104+
The code demonstrates a servo motor sweeping from 0 - 180 - 0 degrees,
105+
in 1-degree intervals.
106+
107+
**Notes and Warnings**
108+
109+
“AmebaServo.h” must be included to use the class function.
110+
111+
112+
**AmebaServo::detach**
113+
114+
**Description**
115+
116+
Detach the servo by disabling the PWM pin previously set in attach().
117+
118+
**Syntax**
119+
120+
void detach(void);
121+
122+
**Parameters**
123+
124+
NA
125+
126+
**Returns**
127+
128+
NA
129+
130+
**Example Code**
131+
132+
NA
133+
134+
**Notes and Warnings**
135+
136+
“AmebaServo.h” must be included to use the class function.
137+
138+
 
139+
=
140+
141+
AmebaServo::write
142+
=================
143+
144+
**Description**
145+
146+
Write an integer value to control servo. The value is between 0 -180
147+
degrees.
148+
149+
**Syntax**
150+
151+
void write(int value);
152+
153+
**Parameters**
154+
155+
value: An integer value that should be between 0 -180. If the value is <
156+
0, it will be taken as 0 and if the value >180, it will be taken as 180.
157+
158+
**Returns**
159+
160+
NA
161+
162+
**Example Code**
163+
164+
Example: ServoSweep
165+
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/Analog/examples/ServoSweep/ServoSweep.ino)
166+
167+
**Notes and Warnings**
168+
169+
“AmebaServo.h” must be included to use the class function.
170+
171+
172+
**AmebaServo::writeMicroseconds**
173+
174+
**Description**
175+
176+
Write a value to control servo. The value is between 544 - 2400us that
177+
represents pulse width.
178+
179+
**Syntax**
180+
181+
void writeMicroseconds(int value);
182+
183+
**Parameters**
184+
185+
value: An integer value that should be between 544 - 2400us as pulse
186+
width. If the value is < 544us, it will be taken as 544us and if the
187+
value > 2400us, it will be taken as 2400us.
188+
189+
**Returns**
190+
191+
NA
192+
193+
**Example Code**
194+
195+
NA
196+
197+
**Notes and Warnings**
198+
199+
“AmebaServo.h” must be included to use the class function.
200+
201+
202+
**AmebaServo::read**
203+
204+
**Description**
205+
206+
The function reads the value from servo and returns current pulse width
207+
as an angle between 0 -180 degrees.
208+
209+
**Syntax**
210+
211+
int read(void);
212+
213+
**Parameters**
214+
215+
NA
216+
217+
**Returns**
218+
219+
This function returns integer value that represents pulse width between
220+
0 - 180 degrees.
221+
222+
**Example Code**
223+
224+
NA
225+
226+
**Notes and Warnings**
227+
228+
“AmebaServo.h” must be included to use the class function.
229+
230+
231+
**AmebaServo::readMicroseconds**
232+
233+
**Description**
234+
235+
The function reads and returns the pulse width of the current servo in
236+
microseconds.
237+
238+
**Syntax**
239+
240+
int readMicroseconds(void);
241+
242+
**Parameters**
243+
244+
NA
245+
246+
**Returns**
247+
248+
This function returns an integer value that represents pulse width in
249+
microseconds.
250+
251+
**Example Code**
252+
253+
NA
254+
255+
**Notes and Warnings**
256+
257+
“AmebaServo.h” must be included to use the class function.
258+
259+
260+
**AmebaServo::attached**
261+
262+
**Description**
263+
264+
Check if the servo PWM pin is attached successfully.
265+
266+
**Syntax**
267+
268+
bool attached(void);
269+
270+
**Parameters**
271+
272+
NA
273+
274+
**Returns**
275+
276+
This function returns 1 if the servo has been attached, else it returns
277+
0.
278+
279+
**Example Code**
280+
281+
Example: ServoSweep
282+
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/Analog/examples/ServoSweep/ServoSweep.ino)
283+
284+
**Notes and Warnings**
285+
286+
“AmebaServo.h” must be included to use the class function.

0 commit comments

Comments
 (0)