Download Print this page

Parallax 900-00005 Manual page 4

Standard servo kickstart

Advertisement

Note: A servo can drain a fresh 9 V battery in less than 20 minutes. For tips on using a separate
power supply for a servo on the HomeWork Board, see the Parallax servos product pages (linked
below).
Propeller QuickStart
OBJ
SERVO : "Servo32v7.spin"
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
ServoCh1 = 0
PUB Servo32_DEMO
SERVO.Start
repeat
' Syntax: SERVO.Set(Pin, Width)
SERVO.Set(ServoCh1,2000)
repeat 800000
SERVO.Set(ServoCh1,1000)
repeat 800000
SERVO.Set(ServoCh1,1500)
repeat 800000
Important! Use a separate AA-size battery pack to power the servo. Connect as shown, being
sure not to mix up any of the wires. You can use alkaline or nickel metal hydride (NiMH) cells.
Note: To use this program you must include the
program file. The Servo32v7 object is included in the download archive file. See the Using
Propeller Objects article (Learn.Parallax.Com > Support > References) for more information on
using Propeller object files.
Copyright © Parallax Inc.
' Servo to pin 0
' Start servo handler
' 2000 usec
' Wait a short bit
' 1000 usec
' 1500 usec (centered)
Servo32v7 object
in the same folder as the
Page 4 of 5

Advertisement

loading