Servo gforth interface

Here is a gforth interface for the C++ library routines (written by Sarvesh Kulkarni) for use with servo motors and the PWM breakout board.
The C++ PWM library pca9685_pwm-09 must be installed first, see the PWM notes.
Then the C++ Servo library must be installed: download servo-03.tar.gz; browse src
  tar zxvf servo-03.tar.gz
  cd servo-03/src
  make
  sudo make install
Installed files are /usr/local/lib/libservo.so and /usr/local/include/servo.h.
Version 03 defines gforth interfaces for all of the Servo public methods for two types of servo motors.

For the HD-1810MG Digital Mini Servo the gforth functions are: hd_setPosition, hd_getPosition, hd_center, and hd_sleep.

For the Parallax Continuous Rotation Servo the gforth functions are: pcr_setPosition, pcr_getPosition, pcr_center, and pcr_sleep.

There are two other generic functions: gservo_version, to get the gservo library version number; and gservo_test to run an interactive test routine.

Installation (creates /usr/local/lib/libgservo.so, /usr/local/include/gservo.h, and /usr/share/gforth/site-forth/gservo-03.fs):

  tar zxvf gservo-03.tar.gz
  cd gservo-03
  make
  sudo make install
After installation, test using the Ctest standalone C program:
  make Ctest
  sudo ./Ctest
To use with gforth:
  sudo gforth
  require gservo-03.fs
  ...
  gservo_test		\ interactive testing
  ...
  hd_getPosition f.
  pcr_getPosition f.
  ...
The first time you use the gservo-03 library, you may notice a startup delay as gforth will create gservo_03 C and object files in your ~/.gforth/libcc-named/ directory. Thereafter, there will be no startup delay as these files will be used automatically whenever you require gservo-03.fs.

gservo-03.tar.gz - download

src - browse files

References:
http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ - Gforth Manual
  section 5.25 - C Interface
PCA 9685 Data Sheet