EasyManuals Logo

Balluff MATRIX VISION mvBlueFOX Series User Manual

Balluff MATRIX VISION mvBlueFOX Series
238 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #164 background imageLoading...
Page #164 background image
156
istringstream iss( getPositionStr() );
iss » std::hex » ipos; // string returned is in hex
return ipos;
}
void moveToPosition( int pos ) const
{
ostringstream oss;
oss « string( "<08 " );
oss « std::hex « setw( 8 ) « setfill( ’0’ ) « pos;
oss « string( ">" ) « ends;
writeConfirmed( oss.str() );
}
void waitForEndOfMove( void ) const
{
while( isRunning() )
{
millisleep( 40 ); // wait until the position has been reached
}
}
// required after plugging FOX out and back in again
void reestablishMotorControl( void ) const
{
while( initializeAndGetVersion().empty() ) {};
}
};
//-----------------------------------------------------------------------------
bool isDeviceSupportedBySample( const Device
*
const pDev )
//-----------------------------------------------------------------------------
{
if( pDev->family.read() != "mvBlueFOX" )
{
return false;
}
return true;
}
//-----------------------------------------------------------------------------
int main( void )
//-----------------------------------------------------------------------------
{
DeviceManager devMgr;
Device
*
pDev = getDeviceFromUserInput( devMgr, isDeviceSupportedBySample );
if( !pDev )
{
cout « "Unable to continue! Press [ENTER] to end the application" « endl;
cin.get();
return -1;
}
try
{
pDev->open();
}
catch( const EDeviceManager& e )
{
cerr « "Could not open device " « pDev->serial.read() « " (" « e.what() « ", " «
e.getErrorCodeAsString() « ")" « endl;
return -1;
}
try
{
MotorControl mc( pDev );
cout « "Found " « mc.getVersion() « endl;
try
{
int i = 4;
while( i-- )
{
mc.moveToPosition( 1500 );
mc.waitForEndOfMove();
cout « mc.getPosition() « endl;
mc.moveToPosition( 2500 );
mc.waitForEndOfMove();
cout « mc.getPosition() « endl;
}
}
catch( const exception& e )
{
cerr « "Exception of " « typeid( e ).name() « " ’" « e.what() « "’" « std::endl;
return -1;
}
}
catch( const exception& e )
{
cerr « "No M3-F found on this device (" « e.what() « ")" « endl;
return -1;
}
pDev->close();
return 0;
MATRIX VISION GmbH

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Balluff MATRIX VISION mvBlueFOX Series and is the answer not in the manual?

Balluff MATRIX VISION mvBlueFOX Series Specifications

General IconGeneral
BrandBalluff
ModelMATRIX VISION mvBlueFOX Series
CategoryDigital Camera
LanguageEnglish

Related product manuals