anyKode Marilou
ContentsIndexHome
Example
//Sample gets the air pressure device from a cone zone then apply pressure

#include "stdafx.h"
#include "Modacpp.h"
#include "conio.h"

#define MODASERVER "localhost"
#define MYROBOTNAME "/"

int main(int argc, char* argv[])
{
ModaCPP::Connection *connection=new ModaCPP::Connection(true);
//Try connect to MODA server
if(connection->Connect(MODASERVER))
    {
    _cprintf("Connection ok to moda server\r\n");

    //Find the robot
    ModaCPP::RobotPHX *phx=connection->QueryRobotPHX(MYROBOTNAME);
    if(phx)
        {
        _cprintf("robot found\r\n");
        ModaCPP::DeviceAirPressure *pDevice=phx->QueryDeviceAirPressure("zone0/air");
        if(pDevice)
            {
            _cprintf("device found\r\n");
            pDevice->GoForce(50);
            connection->Sleep(2000);
            pDevice->GoForce(-50);
            connection->Sleep(4000);
            pDevice->GoForce(50);
            }
        }
    else
        {
        _cprintf("robot not found\r\n");
        }
    }
else
    {
    _cprintf("Unable to connect to moda server\r\n");
    }
//Disconnect & delete
connection->Disconnect();
delete connection;
_getch();
return 0;
}
Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.