Program for testing Position Marker Sensor
- Author
- Marti Morta Garriga - IRI (CSIC-UPC)
- Date
- february 2011 (last revision)
This program sets a digital input, in this case number 2 (pin 7) as a position marker and tests it, leaving the motor free as you can move your load and see how the marker catches positions until 10 times.
Change the parameters of the example or make it automatic using Velocity mode is trivial.
#include <stdio.h>
#include <unistd.h>
#include <iostream>
#include <bitset>
cout << "Epos2 Position Marker:" << endl;
try{
char digin = 2;
cout << " DIGITAL INPUTS:\n";
for(int i=1;i<=10;i++)
cout <<
" DigIN " << i <<
": " << controller.
getDigInState(i) << endl;
cout
<< "\n";
int num_positions = 1;
while(num_positions < 11){
cout << " > New Position: " << endl
num_positions++;
}
}catch(std::exception &e){
cout << e.what() << endl;
}
return 1;
}