PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Devices
Motor
Servo
Standard Servo Position.c
1
/*
2
Standard Servo Position.c
3
4
Moves servo to 0, 90 and 180 degrees. Holds each position for 2 s.
5
Connect servo to P16 port on Propeller Activity Board.
6
7
http://learn.parallax.com/propeller-c-simple-devices/standard-servo
8
*/
9
10
#include "
simpletools.h
"
// Include simpletools header
11
#include "
servo.h
"
// Include servo header
12
13
int
main
()
// main function
14
{
15
servo_angle
(16, 0);
// P16 servo to 0 degrees
16
pause
(3000);
// ...for 3 seconds
17
servo_angle
(16, 900);
// P16 servo to 90 degrees
18
pause
(3000);
// ...for 3 seconds
19
servo_angle
(16, 1800);
// P16 servo to 180 degrees
20
pause
(3000);
// ...for 3 seconds
21
servo_stop
();
// Stop servo process
22
}
23
servo_angle
int servo_angle(int pin, int degreeTenths)
Set Parallax Standard Servo to angle from 0 to 180 in tenths of a degree.
Definition:
servo.c:45
servo_stop
void servo_stop(void)
Stops the servo process and frees a cog.
Definition:
servo.c:197
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,...
servo.h
Control up to 14 servos in another core. For up to 28, add the servoAux library to your project....
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17