1

How can you control a Servo using a Basic Stamp?

Gustavo Litovsky
  • 7,619
  • 3
  • 25
  • 44
littlebirdceo
  • 4,697
  • 8
  • 41
  • 61

1 Answers1

4

Servos' positions are determined by a pulse width signal with a repetition rate of typically 50Hz, so one pulse every 20ms.

enter image description here

The servo's neutral position (halfway) agrees with a 1.5ms pulse width. Shorter pulses will rotate the servo to the left, longer pulses to the right. So all you have to do is periodically create pulses. This document has a servo control demo on page 146. The code used in this demo is simply

PULSOUT Servo, (pWidth */ PwAdj)  ' move the servo
PAUSE 20                          ' servo refresh delay
stevenvh
  • 145,145
  • 21
  • 455
  • 667