main_test.cpp

This is an example of how to use the BHand class.

00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Bernd Roessler                                  *
00003  *   roessler@informatik.uni-hamburg.de                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #include "bhand.h"
00012 
00013 int main()
00014 {
00015   BHand b("/dev/ttyS0");
00016   
00017   try{
00018     b.init();
00019     
00020     while(42)
00021       {
00022         b.open(FINGERS);
00023         b.close(SPREAD);
00024         
00025         for (int i=0; i<1; i++)
00026           {
00027             b.close(F1);
00028             b.close(F3);
00029             b.close(F2);
00030             b.open(FINGERS);
00031           }
00032         
00033         b.open(SPREAD);
00034         for (int i=0; i<1; i++)
00035           {
00036             b.close(FINGERS);
00037             b.open(FINGERS);
00038           }
00039         
00040         b.movePos(SPREAD,1000);
00041         
00042         for (int i=0; i<3; i++)
00043           {
00044             b.movePos(FINGERS, 5000);
00045             b.open(FINGERS);
00046           }
00047         
00048         b.close(F1);
00049         b.open(F1);
00050         b.close(F3);
00051         b.open(F3);
00052         b.close(F2);
00053         b.open(FINGERS);
00054         
00055       }
00056   }
00057   catch (BHandException e)
00058     {
00059       std::cout << e <<std::endl;
00060     }
00061   catch (...)
00062     {
00063       b.stop();
00064     }
00065   return (0);
00066   
00067 }


tams Tim Baier bhandlib v0.25
Generated Wed Aug 16 14:57:08 2006 by doxygen 1.4.7