Update of /cvsroot/libphidget/libphidget/src/examples
In directory usw-pr-cvs1:/tmp/cvs-serv28438
Modified Files:
Makefile.am
Added Files:
servo_example.cc
Log Message:
Initial version of servo_example, doesn't do much yet.
--- NEW FILE: servo_example.cc ---
#include <CPhidgetManager.h>
CUID servoPhidgetID; /**< This will store the servo UID we will be working on */
static const char *revision="$Revision: 1.1 $";
/*
* Find the first servo controller we can
*/
void findUsableServoPhidget()
{
// Look for a servo that we can use for all the examples
vector<CUID> temp=CPhidgetManager::getInstance()->query(LP_SERVO_CONTROLLER);
if (temp.size()<1)
throw runtime_error("This application can't run without a phidget servo controller (see http://www.phidgets.com).\n");
servoPhidgetID=temp[0];
printf("Servo Controller found: %s\n",servoPhidgetID.asString().c_str());
}
/**
* This program is an example to show the many ways to interface with servos and phidget servo manager
*/
main()
{
try
{
char adjusted_version[64];
memcpy(adjusted_version,revision+11,strlen(revision)-11-2);
// What we are
printf("servo_example: code examples of how to communicate with servos\n");
// Get the version number
printf("Version %s\n",adjusted_version);
findUsableServoPhidget();
}
catch(const exception &e)
{
printf("exception:%s\n",e.what());
}
}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/examples/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Makefile.am 7 Sep 2002 21:56:54 -0000 1.1
--- Makefile.am 12 Sep 2002 02:02:44 -0000 1.2
***************
*** 1,3 ****
! bin_PROGRAMS = phidget_c phidget_cpp
phidget_c_SOURCES = phidget_c.c
--- 1,3 ----
! bin_PROGRAMS = phidget_c phidget_cpp servo_example
phidget_c_SOURCES = phidget_c.c
***************
*** 11,14 ****
--- 11,20 ----
phidget_cpp_DEPENDENCIES = ../libphidget/libphidget.la ../phidget++/libphidget++.la
+
+ servo_example_SOURCES = servo_example.cc
+
+ servo_example_LDADD = ../libphidget/libphidget.la ../phidget++/libphidget++.la
+ servo_example_DEPENDENCIES = ../libphidget/libphidget.la ../phidget++/libphidget++.la
+
CFLAGS = -I../libphidget -L../libphidget
CXXFLAGS = -I../libphidget -I../phidget++ -L../libphidget -L../phidget++
***************
*** 30,32 ****
@ @ECHO@ "*** Documentation is not created - install Doxygen"
endif
!
\ No newline at end of file
--- 36,38 ----
@ @ECHO@ "*** Documentation is not created - install Doxygen"
endif
!
|