Ejemplo n.º 1
0
int main(int argc, char** argv) {
  char * hostname = "localhost";
  if(argc > 1) {
    hostname = argv[1];
  }

  if(argc == 3) {
    lo_send(lo_address_new("18.224.0.163", ELMO_UDP_PORT), ELMO_COMMAND, "fff", 0.0f, 0.0f, 0.0f);
    lo_send(lo_address_new("18.224.0.168", ELMO_UDP_PORT), ELMO_COMMAND, "fff", 0.0f, 0.0f, 0.0f);
    return;
  }

  sqlights_light_initialize(hostname);

  initialize_elmo_light("18.224.0.163", "elmo0");
  initialize_elmo_light("18.224.0.168", "elmo1");

  struct timeval tv, tv2;
  gettimeofday(&tv, NULL);
  while(1) {
    while(0 == sqlights_lights_handle(0));
    gettimeofday(&tv2, NULL);
    if(tv2.tv_sec>tv.tv_sec || tv2.tv_usec-tv.tv_usec >= 33000) {
      update_lights();
      tv = tv2;
    }
  }
}
Ejemplo n.º 2
0
int main(int argc, char** argv) {
  char * hostname = "localhost";
  if(argc > 1) {
    hostname = argv[1];
  }

  sqlights_light_initialize(hostname);

  initialize_elmo_light("18.224.0.163", "elmo0");
  initialize_elmo_light("18.224.0.168", "elmo1");

  struct timeval tv, tv2;
  gettimeofday(&tv, NULL);
  while(1) {
    while(0 == sqlights_lights_handle(0));
    gettimeofday(&tv2, NULL);
    if(tv2.tv_sec>tv.tv_sec || tv2.tv_usec-tv.tv_usec >= 33000) {
      update_lights();
      tv = tv2;
    }
  }
}