Adafruit PWM gforth interface

Here is a gforth interface for the C++ library routines (written by Sarvesh Kulkarni) for use with Adafruit's PCA9685 16-channel PWM breakout board.

Version 08 defines gforth interfaces for all of the PWM_Board public methods, with gforth names like pwm_setFreq corresponding to the C++ class method setFreq().

Installation (creates /usr/local/lib/libpwm.so, /usr/local/include/pwm.h, and /usr/share/gforth/site-forth/pwm-08.fs):

  tar zxvf pwm-08.tar.gz
  cd pwm-08
  make
  sudo make install
After installation, test using the Ctest standalone C program:
  make Ctest
  sudo ./Ctest
To use with gforth:
  sudo gforth
  require pwm-08.fs
  ...
  pwm_test			\ interactive testing
  ...
  20e0 pwm_setFreq .		\ manual testing, need e0 for floating-point
  50e0 0 0e0 pwm_setDutyCycle .
  ...
The first time you use the pwm-08 library, you may notice a startup delay as gforth will create pwm_08 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 pwm-08.fs.

pwm-08.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