Basic Phidget Sonar Example

From wikidb
Jump to: navigation, search
 #include <iostream>
 #include <libplayerc++/playerc++.h>
 int
 main(int argc, char *argv[])
 {
   using namespace PlayerCc;
   PlayerClient    robot("localhost");
   AioProxy        ap(&robot,0);
   int             i = 0;
   // Read the 8 digital inputs
   for(i=0; i<30; i++)
   {
     robot.Read();
     std::cout << ap[1] << "  " <<
                  ap[2] << "  " <<
                  ap[3] << "  " <<
                  ap[4] << "  " <<
                  ap[5] << "  " <<
                  ap[6] << "  " <<
     std::endl;
     sleep(1);
   }
 }