TestSoftServo.cpp



/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 2 -*- */
#include <stdio.h>
#include <stdlib.h>

#include <softservo.hpp>
#include <timer.hpp>

int main(int argc, char *argv[])
{
  if(argc<2)
  {
    puts("\nUSE:\nTestSoftEngine <acceleration> <min_value> <max_value> <useconds timer>\n");
    puts("\t  e.g.");
    puts("\t    TestSoftEngine 6 -100 100 100000 => Accelerate 6 each 0,1 second from -100 to 100.\n");

    exit(EXIT_SUCCESS);
  }
  
  CMTimer temp(atol(argv[4]));
  CMSoftServo engine(atol(argv[1]),atol(argv[2]),atol(argv[3]));

  // Go up
  engine.setEnd(32767);
  while(engine.getNow() < atoi(argv[3]))
  {
    if(temp.check()==1)
    {
      engine.update();
      printf("Value:\t%d\n",engine.getNow());
    }
  }
  
  // Go down
  engine.setEnd(-32768);
  while(engine.getNow() > atoi(argv[2]))
  {
    if(temp.check()==1)
    {
      engine.update();
      printf("Value:\t%d\n",engine.getNow());
    }
  }

}
 All Data Structures Functions Variables
Generated on Mon Sep 12 07:59:09 2011 for API MokArdu by  doxygen 1.6.3