source: UH/SAMGAR/SAMGAR LIB/Trunk/TesterFiles/SamgarRecive.cpp @ 187

Revision 187, 1.2 KB checked in by KDucasse, 10 years ago (diff)
Line 
1#include <SamgarMainClass.h>
2using namespace std;
3
4int main() {
5
6Network yarp;
7int myint;
8
9myint = 0;
10
11SamgarModule MyFirstTest("Reciver","FaceDetect","Camera",interupt);
12MyFirstTest.AddPortS("in");
13MyFirstTest.AddPortS("example");
14
15
16while( 1 )
17  {
18  // in this module we accept int data from the specified port. When we call a port for data a true or false returns specifying whether it is new or old data,
19  // and the data reference we pass gets changed if true
20  if(MyFirstTest.GetIntData("in",&myint)==true)
21    {
22     printf("got data %d \n",myint);
23 // in this module we also update the log with this command.
24     if(myint%5==0){MyFirstTest.SendToLog("this has come from a port",3);}
25    }
26  else
27   {
28// this will never be printed proving the module sleeps after each new input
29    printf("got no data \n");
30    }
31 // in an interrupt module this function call has added significance, the primary being the true or false whether it has accomplished its task,
32 // and secondly a variable which could be how well it has acheived the task. This data is sent on to the GUI so the success rate of the modules can be deduced
33  MyFirstTest.SucceedFail(true,myint);
34  }
35  return 0;
36}
Note: See TracBrowser for help on using the repository browser.