Goal: Make an servo rotate to a fixed position and hold it.
Purpose: This will demonstrate the use of the “servo32″ object by Parallax.
Clock frequency: 5,000 Hz
Propeller code type: This propeller code is based on spin language, and uses the “servo32″ object.
Files to download: (right click)
Pics to Download: (click to enlarge)
Note: Only copy and paste from the link above, or formatting issues will occur!
{{
************************************
* demo_servo32_fixed *
* 2008 *
************************************
Goal: Make an servo rotate to a fixed position and hold it.
Purpose: This will demonstrate the use of the "servo32" object by Parallax.
}}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000 'Note Clock Speed for your setup!!
pinServo = 0 'Servo pin number
VAR
OBJ
SERVO : "Servo32v3"
PUB Servo32_DEMO | temp
SERVO.Start 'Start Servo handler
repeat
SERVO.Set(pinServo,1500) 'Set servo to desired position
(position muse be between the range of 1000 to 2000)

Pingback: Ejemplo Básico: Usar multiples servomotores con Parallax Propeller | Ecitronik - Electrónica para todos