int main(int argc, char *argv[])
{
  char line[100];
  float temp;
  
  do {
    printf("Enter tempertature: ");
    fgets(line, sizeof(line), stdin);
  } while (sscanf(line, "%f", &temp) != 1);
  
  printf("%.2f degrees C\n", convert_to_f(temp));

  return 0;
}
void in_received_handler(DictionaryIterator *received, void *context) {
   
  // Looks for key #0 (current temperature) in the incoming message
  Tuple *text_tuple = dict_find(received, 0); 
  if (text_tuple) {
    strncpy(msg, text_tuple->value->cstring, 6);
    msg[6] = '\0';
    if (!celsius) {
      convert_to_f(msg);
      strcat(msg, " F");
    } else {
      strcat(msg, " C");
    }
    text_layer_set_text(hello_layer, msg);
    return;
  }

    // Looks for key #1 (statistics) in the incoming message
  text_tuple = dict_find(received, 1);
  if (text_tuple) {
    char* p = text_tuple->value->cstring;
    strcpy(msg, "Min: ");

    if (!celsius) {
      convert_to_f(p);
      strncat(msg, p, 6);
      strcat(msg, " F\nMax: ");
    } else {
      strncat(msg, p, 6);
      strcat(msg, " C\nMax: ");
    }

    while (*p != ',') {p++;}
    p++;

    if (!celsius) {
      convert_to_f(p);
      strncat(msg, p, 6);
      strcat(msg, " F\nAvg: ");
    } else {
      strncat(msg, p, 6);
      strcat(msg, " C\nAvg: ");
    }

    while (*p != ',') {p++;}
    p++;

    if (!celsius) {
      convert_to_f(p);
      strncat(msg, p, 6);
      strcat(msg, " F\n");
    } else {
      strncat(msg, p, 6);
      strcat(msg, " C\n");
    }

    text_layer_set_text(hello_layer, msg);
    return;
  } 

  // Looks for key #13 (unable to connect to serve) in the incoming message
  text_tuple = dict_find(received, 13);
  if (text_tuple) {
    strcpy(msg, "Unable to connect to server");
    text_layer_set_text(hello_layer, msg);
    return;
  }

    text_tuple = dict_find(received, 3);
  if (text_tuple) {
    strcpy(msg, "Server can't connect to the Arduino");
    text_layer_set_text(hello_layer, msg);
    return;
  }

    // Otherwise: couldn't identify message key
  strcpy(msg, "Error - unidentified key!");
  text_layer_set_text(hello_layer, msg);
}