PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Devices
Motor
Servo360
Set Angles 2 servos.c
1
/*
2
Set Angles.c
3
4
Turns to and holds positions.
5
Behaves like a standard RC servo when it reaches a given angle.
6
*/
7
8
#include "
simpletools.h
"
9
#include "
servo360.h
"
10
11
int
main
()
12
{
13
// Connect is required before control. The first argument is the I/O pin
14
// connected to the white control line, and the second is the I/O pin connected
15
// to the yellow feedback line.
16
servo360_connect
(12, 14);
17
servo360_connect
(13, 15);
18
pause
(1000);
19
20
servo360_angle
(12, 0);
21
servo360_angle
(13, 0);
22
pause
(1000);
23
24
servo360_angle
(12, 45);
25
servo360_angle
(13, -45);
26
pause
(1500);
27
28
servo360_angle
(12, 360 + 45);
29
servo360_angle
(13, -360 -45);
30
pause
(2500);
31
32
servo360_angle
(12, 0);
33
servo360_angle
(13, 0);
34
pause
(1000);
35
}
servo360_angle
int servo360_angle(int pin, int position)
Set an angle in degrees for servo to move to and hold. The default degree is 1/360th of a full circle...
Definition:
servo360_angle.c:17
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
servo360.h
Parallax Feedback 360 High Speed Servo control and monitoring functions. Uses one additional cog to c...
main
int main(void)
Definition:
GraphicsTest.c:20
servo360_connect
int servo360_connect(int pinControl, int pinFeedback)
Initializes a connection to a Parallax Feedback 360 servo. The current position of the servo during t...
Definition:
servo360_connect.c:19
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17