#include "CAVERN.h++"
#include <unistd.h>
 

main(int argc, char** argv)
{

          /// Startup CAVERN.
         CAVERN_irb_c *personalIRB = CAVERNInit(&argc, &argv, NULL);
         if (!personalIRB) exit(1);

         /// Define a local key called A_KEY.
         CAVERN_irbKeyId_c aKeyId;
         aKeyId.setName("A_KEY");

         CAVERN_irb_c::status_t irbStatus;
         CAVERN_irbKey_c *aKey = personalIRB->define(&aKeyId, NULL, &irbStatus);

         float movement = 0;
         float ping = 0.1;
         int size;
         CAVERN_irbKey_c::status_t keyStatus;

         while(1) {
                  size = sizeof(float);
                  aKey->put((char*) &movement,&size, &keyStatus);
                  movement+=ping;
                  if (movement > 3) ping = -ping;
                  if (movement < -3) ping = -ping;
                  sginap(10);

             }

}