{{ TestGaitNomad.spin }} ' ============================================================================== ' ' File...... TestGaitNomad.spin ' Purpose... Test for the HexCrawler Gait Object ' Author.... (C) 2006 Steven R. Norris -- All Rights Reserved ' E-mail.... norris56@comcast.net ' Started... 11/27/2006 ' Updated... 11/28/2006 ' ' ============================================================================== ' ------------------------------------------------------------------------------ ' Program Description ' ------------------------------------------------------------------------------ {{ This is a simple test harness for the Nomad Gait object. See GaitNomad.spin for complete documentation on the interface for this exciting object. }} ' ------------------------------------------------------------------------------ ' Revision History ' ------------------------------------------------------------------------------ {{ 0648a - This is the first version }} CON ' ------------------------------------------------------------------------------ ' Constants ' ------------------------------------------------------------------------------ _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR ' ------------------------------------------------------------------------------ ' Variables ' ------------------------------------------------------------------------------ OBJ Gait : "GaitNomad" ' This is the Nomad Gait object PUB Init ' ------------------------------------------------------------------------------ ' Initialize ' ------------------------------------------------------------------------------ ' Start the Gait object in its own Cog ' Pass the pin that is connected to the Parallax Servo Controller (PSC) Gait.Start(22) ' Wait a bit Pause_ms(1000) ' Home the legs Gait.Home(1) ' Wait a bit before walking Pause_ms(3000) ' Walk forward one step at a time ' Wait for each step to complete before sending another command repeat if not Gait.IsWalking Gait.SetGait(0,0,1,1) PRI Pause_ms(msDelay) waitcnt(cnt + ((clkfreq / 1000) * msDelay))