Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 1585|回復: 0
打印 上一主題 下一主題

How sending data to Google docs

[複製鏈接]
跳轉到指定樓層
1#
發表於 2015-6-7 21:36:57 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
以下是我的程式碼:
  1. #include <SPI.h>
  2. #include <Ethernet.h>

  3. byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
  4. char server[] = "docs.google.com";
  5. IPAddress ip = (192, 168, 0, 107);
  6. //IPAddress subnet = (,,,);
  7. //IPAddress gateway = (,,,);
  8. //IPAddress DNS = (,,,);

  9. EthernetClient client;

  10. void setup()
  11. {
  12.   Serial.begin(9600);
  13.   if (Ethernet.begin(mac) == 0) {
  14.     Serial.println("Failed to configure Ethernet using DHCP");
  15.     Ethernet.begin(mac, ip);
  16.   }
  17.   delay(1000);
  18.   Serial.println("connecting...");
  19.   if (client.connect(server, 80)) {
  20.     Serial.println("connected");
  21.     client.print("GET /forms/d/1R7-wmVhXuPWXnQ2RKimmwC6OGktYoCydRNPDZr7VpZ0/formResponse?ifq&entry.1757053596=Night&entry.1374568256=30&submit=Submit  HTTP/1.1");
  22.     client.println("Host: docs.google.com");
  23.     client.println("Connection: close");
  24.     client.println();

  25.     Serial.print("GET /forms/d/1R7-wmVhXuPWXnQ2RKimmwC6OGktYoCydRNPDZr7VpZ0/formResponse?ifq&entry.1757053596=Night&entry.1374568256=30&submit=Submit  HTTP/1.1");
  26.     Serial.println("Host: docs.google.com");
  27.     Serial.println("Connection: close");
  28.     Serial.println();
  29.   }
  30. }
  31. void loop()
  32. {
  33.   if (client.available()) {
  34.     char c = client.read();
  35.     Serial.print(c);
  36.   }
  37.   if (!client.connected()) {
  38.     Serial.println();
  39.     Serial.println("disconnecting.");
  40.     client.stop();
  41.     while (true);
  42.   }
  43. }
複製代碼
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-5-22 08:06 , Processed in 0.175547 second(s), 10 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表